leetcode

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

3100.cpp (333B)


      1 class Solution {
      2   public:
      3     int maxBottlesDrunk(int numBottles, int numExchange) const {
      4         int res = 0;
      5         while (numBottles >= numExchange) {
      6             numBottles -= numExchange;
      7             res += numExchange;
      8             numBottles++;
      9             numExchange++;
     10         }
     11         return res + numBottles;
     12     }
     13 };