Coding Challenge

Task Scheduler

Medium
heapgreedy

Schedule tasks with cooling intervals.

Given tasks represented by capital letters and a cooldown n, return the minimum number of time units needed to finish all tasks.

Examples

Input: tasks = ["A","A","A","B","B","B"], n = 2

Output: 8

Constraints

  • Tasks can be idle if necessary

Preparing your coding workspace...