Compute minimum time with task cooldowns
Task Scheduling with Cooldowns
You are given a multiset of task types, represented by uppercase letters (e.g., A, A, A, B, B, C). Each task requires exactly 1 time unit to execute. A crucial constraint is that running the same task type requires a minimum of c cooldown time units between any two consecutive executions of that specific task type.
You have the flexibility to reorder tasks and insert idle slots into the schedule as needed. Your objective is to compute the minimum total time units required to complete all tasks.
Deliverables:
- Algorithm Description: Clearly describe your proposed algorithm.
- Correctness Justification: Provide a rigorous justification for why your algorithm yields the minimum total time.
- Complexity Analysis: Analyze the time and space complexity of your algorithm.
- Schedule Construction: Explain how to construct one optimal schedule based on your algorithm.
AI interview prep
Core dilemma
The central engineering conflict is minimizing total execution time by strategically inserting idle slots only when necessary to satisfy cooldown constraints, especially when a single task type dominates the frequency.
2 tradeoffs and 2 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Compute minimum time with task cooldowns
Task Scheduling with Cooldowns
You are given a multiset of task types, represented by uppercase letters (e.g., A, A, A, B, B, C). Each task requires exactly 1 time unit to execute. A crucial constraint is that running the same task type requires a minimum of c cooldown time units between any two consecutive executions of that specific task type.
You have the flexibility to reorder tasks and insert idle slots into the schedule as needed. Your objective is to compute the minimum total time units required to complete all tasks.
Deliverables:
- Algorithm Description: Clearly describe your proposed algorithm.
- Correctness Justification: Provide a rigorous justification for why your algorithm yields the minimum total time.
- Complexity Analysis: Analyze the time and space complexity of your algorithm.
- Schedule Construction: Explain how to construct one optimal schedule based on your algorithm.