← 返回 airbnb 的题目列表Maximum Concurrent Bookings
类型:online_judge
Maximum Concurrent Bookings
You are given n booking intervals, where each interval is represented as [start, end):
start is the booking start time.
end is the booking end time.
Intervals are half-open. A booking ending exactly when another begins does not overlap with it.
Return the maximum number of bookings that are active at the same time.
Input Format
The first line contains an integer n, the number of bookings.
The next n lines each contain two integers, start end, representing [start, end).
Output Format
Print one integer: the maximum number of concurrent bookings.
Example 1
Input:
3
0 30
5 10
15 20
Output:
2
Example 2
Input:
3
7 10
2 4
4 7
Output:
1
Constraints
0 <= n <= 200,000
0 <= start < end <= 10^9
Example
Input
3
0 30
5 10
15 20
Output
2