Maximal Intersection
MediumRating 1600CodeforcesIntervals & Sweep Line
Approach hintTry it first, then revealHide
The intersection of several segments is [max l, min r]. Precompute prefix and suffix values of both, so the result of removing any single segment is available in O(1).