An interval is a pair representing all values from low to high inclusive. ```pseudocode class Interval: low: int high: int
Intervals can be:
- **Closed**: $[1, 5]$ includes both endpoints
- **Open**: $(1, 5)$ excludes both endpoints
- **Half-open**: $[1, 5)$ 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: $a.\text{low} \leq b.\text{high}$ AND $a.\text{high} \geq b.\text{low}$. Overlap check: $O(1)$ per pair.