package leetcode;

/**
 * https://leetcode.com/problems/water-bottles/
 */
public class Problem1518 {
    public int numWaterBottles(int numBottles, int numExchange) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1518 prob = new Problem1518();
        System.out.println(prob.numWaterBottles(9, 3)); // 13
        System.out.println(prob.numWaterBottles(15, 4)); // 19
        System.out.println(prob.numWaterBottles(5, 5)); // 6
        System.out.println(prob.numWaterBottles(2, 3)); // 2
    }
}

@@ -173,38 +173,28 @@
     
-// TODO%0A        return
+int answer =
  0;%0A    
 %7D%0A%0A 
@@ -193,348 +193,294 @@
     
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1518 prob = new Problem1518();%0A        System.out.println(prob.numWaterBottles(9, 3)); // 13%0A        System.out.println(prob.numWaterBottles(15, 4)); // 19%0A        System.out.println(prob.numWaterBottles(5, 5)); // 6%0A        System.out.println(prob.numWaterBottles(2, 3)); // 2
+while (numBottles %3E 0) %7B%0A            numBottles -= numExchange;%0A            if (numBottles %3C 0) %7B%0A                answer += numExchange + numBottles;%0A            %7D else %7B%0A                answer += numExchange;%0A            %7D%0A            numBottles++;%0A        %7D%0A        return answer;
 %0A   

Solve problem 1518