A dead phone needs to run for t minutes of usage time. You have n spare batteries indexed 0 to n - 1, all fully charged at the start. Battery i provides capacity[i] minutes of phone runtime; after it is fully drained, it needs recharge[i] minutes of real-time to be ready again.
Batteries must be used in strict cyclic order: 0, 1, 2, ..., n - 1, 0, 1, .... You cannot skip a battery — if the next one in line is still recharging when its turn comes, the phone sits dead (off) until that battery is ready. Phone usage time does not advance while the phone is off; only real-time advances, allowing other batteries to keep recharging on their own schedules. Once a battery is inserted, the phone runs on it continuously until it is fully drained or the phone hits its t-minute target — you cannot pop a battery out partway through to put in the next one.
Return the indices of the batteries that were fully discharged within the t minutes of usage, in the order they discharged. If the last battery used was only partially drained when the phone hit its t-minute target, it is not included.
This was reported from a Roblox online assessment (August 2025) as the first of two coding tasks in a 50-minute round.
Battery 0 runs from real-time 0 to 3 (full discharge), battery 1 from 3 to 7 (full discharge), battery 2 from 7 to 9 (full discharge). At real-time 9, battery 0 is back (recharged at 8) and runs for 1 more minute before the phone hits 10 minutes of usage — partial use, not counted.
Battery 0 runs 0..5 (full discharge, ready again at 10). Phone is off from real-time 5 to 10. At real-time 10, battery 0 runs another 5 minutes (full discharge), bringing usage to 10.