Easy to understand JavaScript solution (Greedy)
Complexity\n- Time complexity:\nO(nlogn)\n\n- Space complexity:\nO(1)\n\n# Code\n\nvar getMaximumConsecutive = function(coins) {\n    let result = 1;\n\n    coi
# Complexity\n- Time complexity:\n$$O(nlogn)$$\n\n- Space complexity:\n$$O(1)$$\n\n# Code\n```\nvar getMaximumConsecutive = function(coins) {\n    let result = 1;\n\n    coins.sort((a, b) => a - b);\n\n    for (const coin of coins) {\n        if (coin > result) return result;\n        result += coin;\n    }\n    return result;\n};\n```
['JavaScript']