|
| 1 | +<p>You are given two integers <code>numBottles</code> and <code>numExchange</code>.</p> |
| 2 | + |
| 3 | +<p><code>numBottles</code> represents the number of full water bottles that you initially have. In one operation, you can perform one of the following operations:</p> |
| 4 | + |
| 5 | +<ul> |
| 6 | + <li>Drink any number of full water bottles turning them into empty bottles.</li> |
| 7 | + <li>Exchange <code>numExchange</code> empty bottles with one full water bottle. Then, increase <code>numExchange</code> by one.</li> |
| 8 | +</ul> |
| 9 | + |
| 10 | +<p>Note that you cannot exchange multiple batches of empty bottles for the same value of <code>numExchange</code>. For example, if <code>numBottles == 3</code> and <code>numExchange == 1</code>, you cannot exchange <code>3</code> empty water bottles for <code>3</code> full bottles.</p> |
| 11 | + |
| 12 | +<p>Return <em>the <strong>maximum</strong> number of water bottles you can drink</em>.</p> |
| 13 | + |
| 14 | +<p> </p> |
| 15 | +<p><strong class="example">Example 1:</strong></p> |
| 16 | +<img alt="" src="https://assets.leetcode.com/uploads/2024/01/28/exampleone1.png" style="width: 948px; height: 482px; padding: 10px; background: #fff; border-radius: .5rem;" /> |
| 17 | +<pre> |
| 18 | +<strong>Input:</strong> numBottles = 13, numExchange = 6 |
| 19 | +<strong>Output:</strong> 15 |
| 20 | +<strong>Explanation:</strong> The table above shows the number of full water bottles, empty water bottles, the value of numExchange, and the number of bottles drunk. |
| 21 | +</pre> |
| 22 | + |
| 23 | +<p><strong class="example">Example 2:</strong></p> |
| 24 | +<img alt="" src="https://assets.leetcode.com/uploads/2024/01/28/example231.png" style="width: 990px; height: 642px; padding: 10px; background: #fff; border-radius: .5rem;" /> |
| 25 | +<pre> |
| 26 | +<strong>Input:</strong> numBottles = 10, numExchange = 3 |
| 27 | +<strong>Output:</strong> 13 |
| 28 | +<strong>Explanation:</strong> The table above shows the number of full water bottles, empty water bottles, the value of numExchange, and the number of bottles drunk. |
| 29 | +</pre> |
| 30 | + |
| 31 | +<p> </p> |
| 32 | +<p><strong>Constraints:</strong></p> |
| 33 | + |
| 34 | +<ul> |
| 35 | + <li><code>1 <= numBottles <= 100 </code></li> |
| 36 | + <li><code>1 <= numExchange <= 100</code></li> |
| 37 | +</ul> |
0 commit comments