C++/Python, greedy solution with explanation
sort coins first.\n[0, m] are coin we can construct.\n\nand current coin is c,\nso if we use current coin c, we can construct m + c at most.\n\nand if current c
sort coins first.\n[0, m] are coin we can construct.\n\nand current coin is c,\nso if we use current coin c, we can construct m + c at most.\n\nand if current coin c > m + 1,\nthere is no way to construct m + 1 because other coins after conic c >= c.\n\ntc is O(nlogn), sc is O(1).\n### python\n```python\nclass Solution:\n    def getMaximumConsecutive(self, coins: List[int]) -> int:\n        coins.sort()\n        mx = 0\n        for c in coins:\n            if c > mx + 1: break\n            mx += c\n        return mx + 1\n```\n### c++\n```cpp\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(), coins.end());\n        int mx = 0;\n        for (int& c: coins) {\n            if (c > mx + 1) break;\n            mx += c;\n        }\n        return mx + 1;\n    }\n};\n```
['Greedy', 'C', 'Sorting', 'Python']