A
A
A
B
B
B
[0][1][2][3][4][5]
schedule
Greedy · most-frequent-first (max-heap)
▸1count tasks; heap = max-heap by remaining count2time = 03while tasks remain:4 run up to n+1 distinct tasks, highest count first5 (decrement; re-add to heap if count > 0)6 if a slot has no available task → idle7 advance one cooldown frame8return time
state
- n (cooldown)2
- A3
- B3