Skip to content

Commit c4aeeaa

Browse files
committed
1518
1 parent ef030f5 commit c4aeeaa

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Jul-7-24.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def numWaterBottles(self, numBottles: int, numExchange: int) -> int:
3+
def rec(dr=0,c=0,b=numBottles):
4+
if b+c<numExchange:
5+
return dr+b
6+
dr += b
7+
x = (b+c)//numExchange
8+
c = (b+c)%numExchange
9+
return rec(dr,c,x)
10+
return rec()

0 commit comments

Comments
 (0)