Maximize Non-Overlapping Task Scheduling Efficiency
PinterestData Scientist · OnsiteLast updated
This question evaluates understanding of interval scheduling and resource optimization, focusing on reasoning about time intervals and conflict-free selection of tasks.
Scenario
Job scheduler on a single machine wants to maximise throughput.
Question
Given tasks with [start, end) times, return the maximum number of non-overlapping tasks that can be scheduled. Example: [[1,3],[1,5],[4,6]] ➝ 2.
Hints
Sort by end time and greedily pick compatible intervals.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.