[C++] Sort then Greedy
Complexity\n- Time complexity: O(nlogn)\n- Space complexity: O(1)\n\n# Code\n\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n 
# Complexity\n- Time complexity: $$O(nlogn)$$\n- Space complexity: $$O(1)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(), coins.end());\n        int curr = 0;\n        for (const auto& coin : coins) {\n            if (coin > curr + 1) {\n                break;\n            }\n            curr += coin;\n        }\n        return curr + 1;\n    }\n};\n```
['Array', 'Greedy', 'Sorting', 'C++']