You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an integer representing the number of candles you start with, and an integer representing how many burned candles it takes to create a new one, return the number of candles you will have used after creating and burning as many as you can.
5
+
6
+
For example, if given 7 candles and it takes 2 burned candles to make a new one:
7
+
8
+
Burn 7 candles to get 7 leftovers,
9
+
Recycle 6 leftovers into 3 new candles (1 leftover remains),
10
+
Burn 3 candles to get 3 more leftovers (4 total),
11
+
Recycle 4 leftovers into 2 new candles,
12
+
Burn 2 candles to get 2 leftovers,
13
+
Recycle 2 leftovers into 1 new candle,
14
+
Burn 1 candle.
15
+
You will have burned 13 total candles in the example.
0 commit comments