← 返回 meta 的题目列表Meeting Rooms II
类型:online_judge
Problem: Meeting Rooms II
Given an array of meeting time intervals intervals, where intervals[i] = [start_i, end_i] means the i-th meeting starts at start_i and ends at end_i.
Return the minimum number of conference rooms required to schedule all meetings.
If one meeting ends at time t and another meeting starts at time t, they can use the same room.
Input Format
The first line contains an integer n, the number of meetings.
The next n lines each contain two integers start_i end_i, representing a meeting interval.
Output Format
Print one integer: the minimum number of rooms required.
Constraints
0 <= n <= 10^5
0 <= start_i < end_i <= 10^9
Example
Input:
3
0 30
5 10
15 20
Output:
2
Explanation: Meeting [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