Algorithm · Amazon · Hard
Design a task scheduler that supports two operations: addJob(taskId, priority, cooldown=0) getJob() Each task has a string taskId and an integer priority. The scheduler must return the task with the highest priority that is currently eligible. When multiple tasks share the same priority, they should be selected in FIFO order (the one that became eligible earliest comes first; a task becomes eligible when it is added or re‑added, or when its cooldown expires, which for…