Tap here to switch tabs
Problem
Submissions

Problem: Water Bottles

med
30 min
Try to solve the Water Bottles problem.

Statement

You start with numBottles full water bottles and drink them one by one. After drinking a bottle, it becomes an empty bottle. Whenever you have at least numExchange empty bottles, you may trade exactly numExchange empty bottles for 1 new full bottle. This exchange can be performed any number of times as long as you have enough empty bottles.

Return the maximum total number of bottles you can drink.

Constraints:

  • 1≤1 \leq numBottles ≤100\leq 100

  • 2≤2 \leq numExchange ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Water Bottles

med
30 min
Try to solve the Water Bottles problem.

Statement

You start with numBottles full water bottles and drink them one by one. After drinking a bottle, it becomes an empty bottle. Whenever you have at least numExchange empty bottles, you may trade exactly numExchange empty bottles for 1 new full bottle. This exchange can be performed any number of times as long as you have enough empty bottles.

Return the maximum total number of bottles you can drink.

Constraints:

  • 1≤1 \leq numBottles ≤100\leq 100

  • 2≤2 \leq numExchange ≤100\leq 100