Practice · 4 of 5
One Point to Cover Them All
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** n intervals on a line. Choose one real point that lies
inside as many intervals as possible; print that count. (An interval [s, e]
contains a point p if s ≤ p ≤ e.)
**Input:** Line 1: n (1 ≤ n ≤ 10^5). Each line: s e (0 ≤ s ≤ e ≤ 10^9).
**Output:** One integer — the maximum coverage.
**Example:** 3 / (0 10) (2 5) (6 9) → 2 (e.g. point 3 or 7; no point
lies in all three).
Press Submit to check your solution.
Back to lesson: Practice: Greedy Set