simple solution - Beats 100% Runtime
Intuition\nThe problem requires finding the maximum number of consecutive integers starting from 1 that can be formed using the given set of coins. The first th
# Intuition\nThe problem requires finding the maximum number of consecutive integers starting from 1 that can be formed using the given set of coins. The first thought is to sort the coins and then iteratively check whether each coin can extend the range of consecutive numbers that can be formed. If a coin is greater than the current possible range + 1, then it\'s impossible to form the next number, and the solution should stop.\n\n# Approach\n1. Sort the Coins: Start by sorting the coins in ascending order to make it easier to consider the smallest possible combinations first.\n2. Initialize a Counter: Start with a counter at 1, representing the smallest possible sum you can form (with no coins used).\n3. Iterate through the Coins: For each coin, check if it can be used to extend the current range of possible sums. If the coin\'s value is greater than the current counter, you can\'t form the next consecutive number, so break out of the loop.\n4. Update the Counter: If the coin can be used, add its value to the counter and continue.\n5. Return the Counter: The counter will now hold the maximum number of consecutive integers that can be formed starting from 1.\n\n# Complexity\n- Time complexity:\nSorting the array takes \uD835\uDC42(\uD835\uDC5Blog\uD835\uDC5B)\nIterating through the sorted coins takes \uD835\uDC42(\uD835\uDC5B)\nTherefore, the overall time complexity is \uD835\uDC42(\uD835\uDC5Blog\uD835\uDC5B)\n- Space complexity:\nThe space complexity is \uD835\uDC42(1)\nO(1), assuming the sorting is done in-place and only a few extra variables are used.\n# Code\n```\npublic class Solution {\n    public int GetMaximumConsecutive(int[] coins) {\n        Array.Sort(coins);\n        int counter = 1;\n        for(int i = 0;i<coins.Length;i++) {\n            if(coins[i] > counter) break;\n            counter+=coins[i];\n        }\n        return counter;\n    }\n}\n```
['C#']