Nlog(N) || Easy to understand
\n\n# Code\n\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(),coins.end());\n        int l = 0,r=0;\n
\n\n# Code\n```\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(),coins.end());\n        int l = 0,r=0;\n        int maxi = 0;\n        for(int i=0;i<coins.size();i++){\n            int newl = l+coins[i];\n            int newr = r+coins[i];\n\n            if(newl<=r+1){\n                r=newr;\n            }\n            else{\n                maxi = max(maxi,r-l+1);\n                l = newl;\n                r = newr;\n            }\n        }\n        maxi = max(maxi,r-l+1);\n        return maxi;\n    }\n};\n```
['Greedy', 'Sorting', 'C++']