O59
Task Scheduler (CPU Cooldown)
Problem Statement & Objective
Given a characters array tasks and non-negative integer n representing CPU cooldown, return the minimum number of intervals required to complete all tasks.
Function Signature (Python)
task_scheduler_cpu_cooldown(tasks: list[str], n: int) -> intInput & Output Contract
Output Rule:Minimum toplam zaman birimi.
System Constraints
1 <= gorevler.length <= 10^4
gorevler[i] büyük İngilizce harftir
0 <= n <= 100Example Execution Walkthrough
gorevler = ['A','A','A','B','B','B'], n = 2
A -> B -> idle -> A -> B -> idle -> A -> B -> toplam 8 birimExample Test Scenarios (3)
Example 1
Input:
[["A","A","A","B","B","B"],2]Expected Output:
8Example 2: n=0
Input:
[["A","A","A","B","B","B"],0]Expected Output:
6Example 3
Input:
[["A","A","A","A","B","B","C"],2]Expected Output:
10