#C11889. Meeting Rooms Scheduling
Meeting Rooms Scheduling
Meeting Rooms Scheduling
You are given n meetings with their start and end times. Your task is to determine the minimum number of meeting rooms required so that all meetings can take place without overlapping in the same room.
Formally, you are given a list of meetings represented as pairs \( (s_i, e_i) \) where \( s_i \) is the start time and \( e_i \) is the end time of the \( i^{th} \) meeting. Two meetings \( i \) and \( j \) do not overlap if \( s_j \ge e_i \) (assuming \( s_i \le s_j \)). The goal is to assign each meeting to a room in such a way that no two overlapping meetings are in the same room, and the total number of rooms used is minimized.
Hint: A common approach to solve this problem is to sort the meetings by start time and use a min-heap (or priority queue) to keep track of the end times of meetings currently using a room.
The answer for each input will be a single integer denoting the minimum number of meeting rooms required.
inputFormat
The first line contains a single integer n representing the number of meetings. Each of the following n lines contains two integers s and e representing the start time and end time of a meeting.
If n = 0, then there are no meetings and the output should be 0.
outputFormat
Output a single integer representing the minimum number of meeting rooms required so that all meetings can be accommodated without conflicts.
## sample0
0