SHARE
TWEET

Untitled

a guest Jul 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. vector<int> longestStableArrays(vector<vector<long>> queries) {
  2.     vector <int> res;
  3.     for (int i = 0; i < (int) queries.size(); i++) {
  4.         long a = queries[i][0];
  5.         long b = queries[i][1];
  6.         int ans = 0;
  7.         long curr = b;
  8.         long d = a - b + 1;
  9.         while (curr > d) {
  10.             ans++;
  11.             curr -= d;
  12.             d++;
  13.         }
  14.         res.push_back(ans + 2);
  15.     }
  16.     return res;
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top