The Busiest Moment
Each interval [a, b] marks when one guest is present (inclusive endpoints, integer time). What is the maximum number of guests present at the same moment?
Input: the first line has N; the next N lines each have two integers a b (a ≤ b).
Output: the maximum simultaneous count.
Constraints:
- 1 ≤ N ≤ 105
- 0 ≤ a ≤ b ≤ 106
Sample Tests
Input 1
3 1 5 2 3 4 8
Output 1
2
Input 2
2 1 2 3 4
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.