1798. Maximum Number of Consecutive Values You Can Make.cpp
Code\n\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(),coins.end());\n        int ans=0;\n        in
**Code**\n```\nclass Solution {\npublic:\n    int getMaximumConsecutive(vector<int>& coins) {\n        sort(coins.begin(),coins.end());\n        int ans=0;\n        int curr=1;\n        int n=coins.size();\n        for( int i=0;i<n;i++){\n           if(curr==coins[i]){               \n               curr*=2;\n               ans=curr-1;\n           }\n           else if(curr>coins[i]){\n               curr+=coins[i];\n               ans=curr-1;\n           }\n           else {\n               break;\n           }\n        }\n        return ans+1;        \n    }\n};\n```
['C']