Back to course home
0% completed
Solution: Water Bottles
Problem Statement
There are numBottles
number of bottles filled with water. You can trade a numExchange
number of empty bottles and get a single filled water bottle.
When you drink a bottle, it becomes empty.
Given the two integers numBottles
and numExchange
, return the maximum number of water bottles you can drink.
Examples
Example 1
- Input: numBottles =
15
, numExchange =4
- Expected Output:
19
- Explanation:
- You start with 15 full bottles.
- Drink 15 bottles (now 15 empty).
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible