Back to problems

Task Scheduler with Priority + Lazy Deletion

Algorithm · Citadel · Medium

Requirements Provide the following operations: insert(task_id, priority) — register a task using the supplied priority. delete(task_id) — remove a task by its identifier; later execute operations must not return that task. execute() -> task_id — remove and yield the active task with the greatest priority. The candidate should define what happens when no task is available, such as returning a sentinel, raising an error, or waiting. The intended solution should optimize…

Checking your access…