Short Easy C++ Code
\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(),coins.end());\n        int n=coins.size();\n       
```\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(),coins.end());\n        int n=coins.size();\n        int till=1; //1 + point where we can reach now\n        for(int i=0;i<n;i++)\n        {\n            if(coins[i]>till) // we could only make sum to (till-1) yet and so integer we require should have max value=till it can have less value than that too\n                break;\n            till+=coins[i]; \n\t\t\t// as we have already reached all point to till-1 we can reach all points to till-1+coins[i] now\n        }\n        return till;\n        \n    }\n};\n```
[]