Practice Single-Threaded CPU
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
tasks[i] = [enqueueTime,processingTime] describes a task with original index i. A single CPU waits if no task is available. When idle with tasks available, it chooses the shortest processing time, breaking ties by smallest original index. Once started, a task runs to completion; the next may start immediately. Return the task indices in processing order.
Source: Single-Threaded CPU on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
tasks = [[1,2],[2,4],[3,2],[4,1]]
[0,2,3,1]
# Example 2
tasks = [[7,10],[7,12],[7,5],[7,4],[7,2]]
[4,3,2,0,1]
Constraints
Related LeetCode Problems
Practice more problems similar to Single-Threaded CPU.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.