Interval Scheduling Maximization
The interval scheduling maximization (ISM) problem is to find a largest compatible set - a set of non-overlapping intervals of maximum size. The goal here is to execute as many tasks as possible.
Algorithm
Greedily select the interval with the earliest ending time.
Sort the intervals in ascending order of the end time. (We don't care the start time)
Scan through the intervals and greedily collect non-overlapping intervals.
Memorize point 1: For all the intervals whose start times are not overlapping with earlier intervals, picking the one ending first must be optimal.
Implementation
Problem
646. Maximum Length of Pair Chain (Medium) Direct Application
Reference
https://en.wikipedia.org/wiki/Interval_scheduling
Last updated