beat 100%
\n# Complexity\n- Time complexity:\nO(n)+O(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>
\n# Complexity\n- Time complexity:\nO(n)+O(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n\n        sort(coins.begin(),coins.end());\n        int i=0;\n        int n=coins.size();\n        int range=0;\n\n        while(i<n){\n            if(coins[i]<=range+1){\n                range+=coins[i];\n                i++;\n            }\n            else break;\n        }\n        return range+1; \n    }\n};\n```
['C++']