An interval is a pair representing all values from low to high inclusive. class Interval: low: int high: int Intervals can be: - Closed: includes both endpoints - Open: excludes both endpoints - Half-open: includes low, excludes high For most problems, you use closed intervals.
The algorithms work the same regardless; just adjust your overlap checks.
Two intervals overlap if one starts before the other ends AND ends after the other starts: AND . Time: . Space: .