Search
⌘K

Leetcode 1834. Single-Threaded CPU

Given tasks with enqueue and processing times, return the order a single-threaded CPU will process them when it always picks the available task with the smallest processing time (tie-broken by original index). This is typically solved by sorting tasks by enqueue time and using a min-heap to manage available tasks and advance time when the CPU is idle.

Asked at:

DoorDash


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early October, 2025

DoorDash

Mid-level

Mid June, 2025

DoorDash

Senior

Your account is free and you can post anonymously if you choose.