leetcode

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

1518.cpp (269B)


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