leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1798.cpp (275B)


      1 class Solution {
      2   public:
      3     int getMaximumConsecutive(vector<int> &coins) const {
      4         sort(begin(coins), end(coins));
      5         int res = 1;
      6         for (const int c : coins) {
      7             if (c > res) break;
      8             res += c;
      9         }
     10         return res;
     11     }
     12 };