rate empty branded cups and you get one full cup. You start with full full cups. Once you drink a cup it becomes empty and can be handed in along with the others.
Return the total number of cups you can drink if you keep trading empties for as long as you can.full=7, rate=3 → 10
Drink 7 cups, trade 6 empties for 2 full ones (1 empty is left over). Drink those and you hold 3 empties again, worth 1 more cup. Total: 7 + 2 + 1 = 10.
full=4, rate=5 → 4
You never collect 5 empties, so no trade is possible and the answer is 4.
full=12, rate=2 → 23
full=7, rate=3
10
Run checks the first 3 tests in your browser. Submit checks all 76 tests on the server, hidden ones included.