← 返回 google 的题目列表Minimum Number of Meeting Rooms
类型:online_judge
Problem: Minimum Number of Meeting Rooms
Given an array of meeting time intervals intervals, where each interval is represented as [start, end], meaning the meeting starts at start and ends at end.
Treat intervals as half-open intervals [start, end). Therefore, if one meeting ends at time t and another meeting starts at time t, they can use the same meeting room.
Return the minimum number of meeting rooms required to schedule all meetings.
Input Format
The first line contains an integer n, the number of meetings.
The next n lines each contain two integers start end, representing one meeting interval.
Output Format
Print one integer: the minimum number of meeting rooms required.
Constraints
0 <= n <= 100000
0 <= start < end <= 10^9
Example 1
Input:
3
0 30
5 10
15 20
Output:
2
Example 2
Input:
2
7 10
2 4
Output:
1
Example
Input
3
0 30
5 10
15 20
Output
2