O(nlogn) Soln
Complexity\n- Time complexity:O(nlogn)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e.g. O(n) \n\n# 
# Complexity\n- Time complexity:$$O(nlogn)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:$$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n``` java []\nfinal class Solution {\n    public int getMaximumConsecutive(final int[] coins) {\n        Arrays.sort(coins);\n        int s = 0;\n        for(final var c: coins){\n            if (s < c - 1) break;\n            s += c;\n        }return s + 1;\n    }\n}\n```\n``` python []\nclass Solution:\n    def getMaximumConsecutive(self, coins: List[int]) -> int:\n        coins.sort()\n        s = 0;\n        for c in coins:\n            if s < c - 1:\n                break\n            s += c\n        return s + 1\n```\n``` rust []\nimpl Solution {\n    pub fn get_maximum_consecutive(mut coins: Vec<i32>) -> i32 {\n        coins.sort_unstable();\n        let mut s = 0;\n        for c in coins{\n            if s < c - 1 {\n                break;\n            }\n            s += c;\n        }\n        s + 1\n    }\n}\n```\n``` Erlang []\n-spec get_maximum_consecutive(Coins :: [integer()]) -> integer().\nget_maximum_consecutive(Coins) ->\n  SortedCoins = lists:sort(Coins), \n  helper(SortedCoins, 0).\n\n-spec helper(Coins :: [integer()], Acc :: integer()) -> integer().\nhelper([], Acc) -> Acc + 1;\nhelper([H | T], Acc) when Acc < H - 1 -> Acc + 1;\nhelper([H | T], Acc) -> helper(T, Acc + H).\n```\n``` Elixir []\ndefmodule Solution do\n  @spec get_maximum_consecutive(coins :: [integer]) :: integer\n  def get_maximum_consecutive(coins) do\n   coins = Enum.sort(coins)\n   helper(coins, 0)    \n  end\n\n  @spec helper(coins :: [integer], acc :: integer) :: integer\n  defp helper([], acc), do: acc + 1\n  defp helper([h | t], acc) when acc < h - 1, do: acc + 1\n  defp helper([h | t], acc), do: helper(t, acc + h)\nend\n```
['Prefix Sum', 'Python', 'Java', 'Rust', 'Elixir', 'Erlang']