← Questions
Task scheduler that pops the earliest deadline once its subtasks are done
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Implement a class with add_tasks(tasks) and consume_task(). Each task has an id, a deadline and a list of subtasks.
-
consume_taskreturns the task with the earliest deadline, or a "no task" result when empty. - A task may only be consumed after its subtasks are done; return the earliest-deadline task that is ready.
- Make both operations fast (for example with a heap) and give their complexity.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding
