[Java/C++/Python] Accumulate the Coins
Intuition\n"Return the maximum number ... you can make with your coins  starting from and including 0"\nthis equals to\n"Return the minimum number that you can 
# **Intuition**\n"Return the maximum number ... you can make with your coins  starting from and **including 0**"\nthis equals to\n"Return the minimum number that you can not make .."\n<br>\n\n# **Explanation**\nBecause samll values can only discompose to samller numbers,\nwe sort the input array and check from the small coins.\n\n`res` means the next value we want to make,\nand we can already make `0,1,2,3...res-1`.\n\nWe iterate the array,\nIf `a > res`, all remaining numbers are bigger than `res`,\nwe can not make `res` in all means,\nso we break the loop and return `res`\n\nIf `a <= res`,\nwe could make from `0` to `res - 1`,\nnow with `a` so we can make from `a` to `res + a - 1`,\nand `a <= res`, so our next goal becomes `res + a` now.\nso in this case, we simply `res += a`\n<br>\n\n# **Complexity**\nTime `O(sort)`\nSpace `O(sort)`\n<br>\n\n**Java**\n```java\n    public int getMaximumConsecutive(int[] A) {\n        Arrays.sort(A);\n        int res = 1;\n        for (int a: A) {\n            if (a > res) break;\n            res += a;\n        }\n        return res;\n    }\n```\n\n**C++**\n```cpp\n    int getMaximumConsecutive(vector<int>& A) {\n        sort(A.begin(), A.end());\n        int res = 1;\n        for (int a: A) {\n            if (a > res) break;\n            res += a;\n        }\n        return res;\n    }\n```\n\n**Python**\n```py\n    def getMaximumConsecutive(self, A):\n        res = 1\n        for a in sorted(A):\n            if a > res: break\n            res += a\n        return res\n```\n
[]