Task Scheduler
Medium
Topics
Given a string tasks of uppercase-letter task types and a cooldown n (passed as the second value), each task takes one unit and identical tasks must be at least n units apart. Return the minimum number of units to finish all tasks.
Example 1
Input: tasks = "AAABBB", n = 2 Output: 8
Example 2
Input: tasks = "AAABBB", n = 0 Output: 6
Constraints
- 1 <= tasks.length <= 10^4
- tasks are uppercase English letters.
- 0 <= n <= 100
Run ⌘' · Submit ⌘⏎