# Leetcode 1518 - Water Bottles

Note:

• Intuition: recursion
• In every state, we need to know fullBottles and emptyBottles. Include drinks as result as a param.
• Base case: fullB === 0, return drinks.
• Next state:
• Add all fullB to drinks.
• emptyB = fullB + emptyB % exchange.
• next fullBottles is what you’ve exchange with all bottles. floor(full + empty) / exchange

Question:

Given numBottles full water bottles, you can exchange numExchange empty water bottles for one full water bottle.

The operation of drinking a full water bottle turns it into an empty bottle.

Return the maximum number of water bottles you can drink.

Example:

Code: