Candles from Stubs — Solution & Editorial
Simulate in bulk: burn all, convert stubs to new candles, carry the remainder — each round divides by K, so O(log) rounds.
Complexity: O(1) or O(log)
Simulate in bulk: burn all, convert stubs to new candles, carry the remainder — each round divides by K, so O(log) rounds.
Complexity: O(1) or O(log)