Divide Intervals Into Minimum Number of Groups
MediumLeetCodeIntervals & Sweep Line
Approach hintTry it first, then revealHide
The minimum number of groups equals the largest number of intervals that share a single point. Sweep the start and end events, remembering that both endpoints are inclusive, or keep a min-heap of group end times.