Task Scheduler With Cooldown

Asked at Amazon · Coding Questions · Difficulty: Medium

Given `tasks` (uppercase letters) and a cooldown `n`, each interval runs one task or is idle, and two same-labelled tasks must be at least `n` intervals apart. Return the minimum number of intervals to finish all tasks.

Loading the problem…