← 返回 ramp 的题目列表Minimum Meeting Rooms
类型:online_judge
Problem: Minimum Meeting Rooms
You are given n meeting time intervals intervals, where each interval is represented as [start, end]. It means a meeting starts at start and ends at end.
Intervals are treated as half-open intervals: if one meeting ends at time t and another meeting starts at time t, they can use the same room and do not conflict.
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 the start and end time of a meeting.
Output Format
Print one integer, the minimum number of meeting rooms required.
Constraints
0 <= n <= 100000
0 <= start <= end <= 10^9
Intervals are not guaranteed to be sorted.
Example
Input:
3
0 30
5 10
15 20
Output:
2
Explanation: [0,30] overlaps with the other two meetings, so at least 2 rooms are needed.
Example
Input
3
0 30
5 10
15 20
Output
2