C++/Python/Javascript Solution, O(NLogN) Time and O(logn) space
The space complexity is O(logn), There are logN stack frame when running quick sort.\nThanks @lee215 to point it out.\n\n#### Idea\n- sort the Array\n- We start
The space complexity is O(logn), There are logN stack frame when running quick sort.\nThanks @lee215 to point it out.\n\n#### Idea\n- sort the Array\n- We start from 0 as current, means we can cover all the number from 0 ~ current, and if current + 1 >= next_number, that means we can cover all the number from 0 ~ current + next_number, so current += next_number.\n\n#### Complexity\n- Time: O(NLogN)\n- Space: O(1)\n#### C++\n```\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(), coins.end());\n        int cur = 0;\n        for(int i = 0; i < coins.size(); ++i) {\n            if(cur + 1 >= coins[i]) {\n                cur += coins[i];\n            }\n        }\n        return cur + 1;\n    }\n};\n```\n\n#### Python\n```\nclass Solution(object):\n    def getMaximumConsecutive(self, coins):\n        """\n        :type coins: List[int]\n        :rtype: int\n        """\n        coins.sort();\n        cur = 0;\n        for i in range(0, len(coins)):\n            if cur + 1 >= coins[i]:\n                cur += coins[i]\n                \n        return cur + 1\n```\n\n#### Javascript\n```\nvar getMaximumConsecutive = function(coins) {\n    coins.sort((a, b) => a - b);\n    let cur = 0;\n    for(let i = 0; i < coins.length; ++i) {\n        if(cur + 1 >= coins[i]) {\n            cur += coins[i];\n        }\n    }\n    return cur + 1;\n};\n```
[]