Company: JPMorgan Chase
Difficulty: medium
Task Scheduler Problem Description Implement a task scheduler that determines the minimum number of machines required to complete a given set of n tasks. Each task runs from time start[i] through end[i] (inclusive). A machine can run only one task at a time, and each task must be scheduled on exactly one machine. Complete the function getMinMachines in the editor with the following parameters: int start[n] : the start times of tasks int end[n] : the end times of tasks Returns int : the minimum number of machines required to run all the tasks Examples Example 1: Input: n = 5 start = [1, 8, 3, 9, 6] end = [7, 9, 6, 14, 7] Output: 3 Explanation: One possible schedule is: Machine 1: Tasks at times (1,7) and (8,9) Machine 2: Tasks at times (3,6) and (9,14) Machine 3: Task at time (6,7) The minimum number of machines required is 3. Constraints 1 1