[Python3] O(NlogN) Greedy solution + explanation
Intuition\nThe problem requires determining the maximum number of consecutive integer values that can be made using the given coins, starting from 0. The key ob
# Intuition\nThe problem requires determining the maximum number of consecutive integer values that can be made using the given coins, starting from 0. The key observation here is that if we can create all values up to a certain integer `x`, and the next coin has a value less than or equal to `x`, then we can extend the range of consecutive values we can create.\n\n# Approach\n1. **Sort the Coins**: Start by sorting the coins in ascending order. This allows us to iteratively build the range of consecutive sums in a structured manner.\n  \n2. **Initialize**: Initialize `next_coin` to 1. This variable represents the smallest value that we cannot currently form with the given subset of coins.\n\n3. **Iterate Through Coins**: Iterate through each coin:\n   - If the value of the coin is less than or equal to `next_coin`, it means we can use this coin to extend our range of consecutive sums.\n   - Update `next_coin` by adding the value of the current coin. This extends the range of consecutive sums we can form.\n\n4. **Break Condition**: If a coin\'s value is greater than `next_coin`, break the loop as we can no longer form consecutive sums with the remaining coins.\n\n5. **Return Result**: The value of `next_coin` after the loop completes will be the maximum number of consecutive integers that can be formed.\n\n# Complexity\n- Time complexity: $$O(n \\log n)$$\n  - Sorting the coins takes $$O(n \\log n)$$ time.\n  - Iterating through the coins takes $$O(n)$$ time.\n  \n- Space complexity: $$O(1)$$\n  - Only a few variables are used, regardless of the input size.\n\n# Code\n```python\nclass Solution:\n    def getMaximumConsecutive(self, coins: List[int]) -> int:\n        coins.sort()\n        next_coin = 1\n        for coin in coins:\n            if next_coin - coin < 0: \n                break\n            next_coin += coin\n        return next_coin\n
['Greedy', 'Sorting', 'Python3']