0621. Task Scheduler
Description
**Input:** tasks = ["A","A","A","B","B","B"], n = 2
**Output:** 8
**Explanation:**
A -> B -> idle -> A -> B -> idle -> A -> B
There is at least 2 units of time between any two same tasks.**Input:** tasks = ["A","A","A","B","B","B"], n = 0
**Output:** 6
**Explanation:** On this case any permutation of size 6 would work since n = 0.
["A","A","A","B","B","B"]
["A","B","A","B","A","B"]
["B","B","B","A","A","A"]
...
And so on.ac1: priority queue
ac2: greedy, count idle slots
Last updated