One Meeting Room
Meetings [start, end) are given. Can one person attend ALL of them (a meeting ending at time t does not clash with one starting at t)?
Input: the first line has N; the next N lines each have start and end.
Output: YES or NO.
Constraints:
- 1 ≤ N ≤ 105
- 0 ≤ start < end ≤ 106
Sample Tests
Input 1
3 0 30 5 10 15 20
Output 1
NO
Input 2
2 5 8 8 12
Output 2
YES
Discussion (opens after you solve — no spoilers before)
No comments yet.