the question:
Give numBottles(input) full water bottles, you can exchange numExchange(input) empty 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.
No functions, imports, whatsoever, only list, string, int, loops and that kinda stuff.
Ex.1:
Input(s): numBottles = 9, numExchange = 3
Output: 13
Explanation: You can exchange 3 empty bottles to get 1 full water bottle.
Number of water bottles you can drink: 9+3+1 = 13
visual
let 0 be water bottle, e = empty watr bottle.
000 eee. 0 e
000 -----> eee ---->0 ---->. e --> 0 ---> e
000 eee. 0 e
Ex.2:
Input(s) :numbottles = 15, numexchange = 4
Output: 19
Explanation: You can exchange 4 empty bottles to get 1 full water bottle.
Number of water bottles you can drink: 15 + 3 + 1 = 19
Thx so much!