We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02717fd commit 7ed5b7cCopy full SHA for 7ed5b7c
3100. Water Bottles II.cpp
@@ -0,0 +1,15 @@
1
+class Solution {
2
+public:
3
+ int maxBottlesDrunk(int numBottles, int numExchange) {
4
+ int bottleDrunk = numBottles;
5
+ int emptyBottles = numBottles;
6
+
7
+ while (emptyBottles >= numExchange) {
8
+ emptyBottles -= numExchange;
9
+ numExchange++;
10
+ bottleDrunk++;
11
+ emptyBottles++;
12
+ }
13
+ return bottleDrunk;
14
15
+};
0 commit comments