• + 0 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);
    }