Easy JS with O(nlogn) time complexity
Complexity\n- Time complexity: O(nlogn)\n- Space complexity: O(n)\n\n# Idea\nJust check: if any coins[i] > sum(coins, i - 1) + 1 THEN cannot find elements with 
# Complexity\n- Time complexity: O(nlogn)\n- Space complexity: O(n)\n\n# Idea\nJust check: if any coins[i] > sum(coins, i - 1) + 1 THEN cannot find elements with sum coins[i] - 1\n\n# Code\n```\n/**\n * @param {number[]} coins\n * @return {number}\n */\nvar getMaximumConsecutive = function(coins) {\n  coins.sort((a, b) => a - b)\n  let sum = 0\n  for (let i = 0; i < coins.length; i++) {\n    if (coins[i] > sum + 1) {\n        break\n    }\n    sum += coins[i]\n  }\n  return sum + 1\n};\n```
['JavaScript']