You're given n movie screenings, each with a start time and an end time
(a screening occupies the half-open interval [start, end), so a screening
ending exactly when another starts does not conflict with it). You can
only watch one screening at a time. Find the maximum number of screenings you
can watch in full.
Line 1: integer n (1 ≤ n ≤ 2·10^5)
Next n lines: two integers start end (0 ≤ start < end ≤ 10^9)
A single integer: the maximum number of non-overlapping screenings.
Input:
3
1 5
2 3
4 6
Output:
2
```
Explanation: watch `[2,3)` then `[4,6)`.
### Constraints
- 1 ≤ n ≤ 2·10^5
- 0 ≤ start < end ≤ 10^9
Case 1
3 1 5 2 3 4 6
2
Case 2
3 1 2 2 3 3 4
3
Input
3 1 5 2 3 4 6
Expected Output
2
Run or submit your code to see output here.