Minimum Days to Execute Ordered Tasks with Cooldown

Given a fixed-order list of tasks tasks and a non-negative cooldown n, execute at most one task per day. You may also leave a day idle.

When a task type was last executed on day d, its next...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: