Practice ยท 2 of 3
Urgency Queue with a Heap
Simulate task scheduling with a priority queue:
- record Task(String name, int priority) in Solution
- static List<String> processTasks(List<Task> tasks, int slots):
put all tasks into a PriorityQueue ordered by priority ASCENDING
(1 = most urgent), then poll up to slots tasks and return their
names in processing order.
Same priority โ FIFO among equals (use a sequence tiebreaker in the
comparator).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Collections Lab