TIME O(nlogn) || SPACE O(1) || C++ || SIMPLE
Intuition\nThe problem requires us to find the maximum number of consecutive integers (starting from 1) that can be formed using given coins. Intuitively, if we
# Intuition\nThe problem requires us to find the maximum number of consecutive integers (starting from 1) that can be formed using given coins. Intuitively, if we sort the coins and iterate through them, we can keep a running sum of the coin values. As long as the next coin can be added to this sum to form a consecutive sequence, we continue; otherwise, we break out of the loop. The key insight is that if the next coin is larger than sum + 1, we cannot form the next consecutive number.\n\n\n\n# Approach\nSort the coins in ascending order.\nInitialize a variable sum to keep track of the running total of the coin values.\nIterate through the sorted coins:\nIf the current coin can be used to extend the sequence of consecutive integers (i.e., sum + 1 >= coin), add the coin\'s value to sum.\nIf the current coin cannot be used to extend the sequence, break out of the loop.\nReturn sum + 1 as the maximum number of consecutive integers that can be formed.\n# Complexity\n- Time complexity:\n   O(nlogn)\n- Space complexity:\n\uD835\uDC42(1)\n\n\n# Code\n```\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n         \n         int sum = 0;\n         sort(coins.begin(),coins.end());\n         for(int i=0;i<coins.size();i++){\n             if(sum + 1 >= coins[i]){\n                sum += coins[i];\n             }else{\n                break;\n             }\n         }\n         return sum+1;\n    }\n};\n```
['Array', 'Greedy', 'Sorting', 'C++']