Solution: Schedule Tasks on Minimum Machines

Let's solve the Schedule Tasks on Minimum Machines problem using the Two Heaps pattern.

Statement

We are given an input array, tasks, which contains the start and end times of nn tasks. Your task is to find the minimum number of machines required to complete these nn tasks.

Constraints:

  • n==n == tasks.length
  • 1<=1 <= tasks.length <=103<= 10^{3}
  • 00 ≤\leq tasksi.starttasks_{i}.start <\lt tasksi.endtasks_{i}.end ≤\leq 10410^{4}

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