1834. Single-Threaded CPU

Practice Single-Threaded CPU for free on NudgeCode: Medium, Heap pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Task i is tasks[i] = [enqueueTime, processingTime]: it becomes available at time enqueueTime and takes processingTime units to run. A single CPU works like this:

Return the task indices in the order the CPU runs them.

Example

tasks = [[1,2],[2,4],[3,2],[4,1]]  ->  [0,2,3,1]

Constraints