Try to solve the Task Scheduler problem.
We'll cover the following
Statement
Given a character array tasks
, where each character represents a unique task and a positive integer n
that represents the cooling period between any two identical tasks, find the minimum number of time units the CPU will need to complete all the given tasks. Each task requires one unit to perform, and the CPU must wait for at least n
units of time before it can repeat the same task. During the cooling period, the CPU can perform other tasks or remain idle.
Constraints:
 tasks.length
Ân
tasks
consists of uppercase English letters
Examples
Let’s take a look at a few examples to get a better understanding of the problem statement: