You are viewing a single comment's thread. Return to all comments →
int pickingNumbers(vector<int> a) { sort(a.begin(), a.end()); int c = 0; int i = a[0]; int l = 0; for (auto n : a) { if (n - i > 1) { l = max(c, l); c = 1; i = n; } else { c++; } } return max(l, c); }
Seems like cookies are disabled on this browser, please enable them to open this website
Picking Numbers
You are viewing a single comment's thread. Return to all comments →