DIY: Task Scheduler

Solve the interview question "Task Scheduler" in this lesson.

Problem statement

You are given a character array of tasks, where each character represents a different task that the CPU needs to carry out. Each time the CPU executes a given task, a specific number of intervals must elapse before the CPU can run the same task again. This idle time will also be given. Calculate the minimum time needed to complete all the tasks. We will assume that carrying out each task takes a one-time interval.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.