Tap here to switch tabs
Problem
Submissions

Problem: Water Bottles II

med
30 min
Try to solve the Water Bottles II problem.

Statement

You are given two integers, numBottles and numExchange.

Initially, you have numBottles full water bottles. In one operation, you can perform one of the following actions:

  • Drink any number of full water bottles, turning each into an empty water bottle.

  • Exchange numExchange empty water bottles for 11 full water bottle, and then increase the value of numExchange by 11.

Return the maximum number of water bottles you can drink.

Note: Each exchange operation consumes numExchange empty bottles and immediately increments numExchange by 11. You cannot perform multiple exchanges simultaneously with the same numExchange value.

Constraints:

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

  • 1≤1 \leq numExchange ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Water Bottles II

med
30 min
Try to solve the Water Bottles II problem.

Statement

You are given two integers, numBottles and numExchange.

Initially, you have numBottles full water bottles. In one operation, you can perform one of the following actions:

  • Drink any number of full water bottles, turning each into an empty water bottle.

  • Exchange numExchange empty water bottles for 11 full water bottle, and then increase the value of numExchange by 11.

Return the maximum number of water bottles you can drink.

Note: Each exchange operation consumes numExchange empty bottles and immediately increments numExchange by 11. You cannot perform multiple exchanges simultaneously with the same numExchange value.

Constraints:

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

  • 1≤1 \leq numExchange ≤100\leq 100