simple maths || easy to understand || o(N) time && o(1) space ||
Code\n\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        \n          //if i dont take anything that will sum to 0\n      
# Code\n```\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        \n          //if i dont take anything that will sum to 0\n          int maxVal = 0;\n          sort(coins.begin(),coins.end());\n          for(int i = 0 ; i < coins.size() ; i++){\n              //we cannot add the coins\n              if(coins[i] == (maxVal+1)){\n                  maxVal = ((2*maxVal)+1);\n              }else if(coins[i] > (maxVal+1)){\n                 return maxVal+1;\n              }else if(coins[i] < (maxVal+1)){\n                  maxVal = maxVal + coins[i];\n              }\n          }\n          return maxVal+1;\n    }\n};\n```
['Array', 'Greedy', 'Sorting', 'C++']