#C5496. Minimum Meeting Rooms

    ID: 49151 Type: Default 1000ms 256MiB

Minimum Meeting Rooms

Minimum Meeting Rooms

You are given a list of time intervals, where each interval \([start, end]\) represents the time during which a meeting takes place. Your task is to determine the minimum number of meeting rooms required so that all meetings can be held without any overlap.

A meeting room can only accommodate one meeting at a time. Therefore, if two meetings overlap, they must be scheduled in different rooms. Formally, given intervals \(I_1, I_2, \dots, I_n\) where \(I_i = [start_i, end_i]\), you need to compute the smallest number \(R\) such that each meeting can be assigned a room and no two meetings assigned the same room overlap.

Example:

Input:
3
30 75
0 50
60 150

Output: 2

</p>

inputFormat

The first line contains an integer \(n\), the number of meetings. Each of the following \(n\) lines contains two space-separated integers representing the start time and end time of a meeting.

For example:

3
30 75
0 50
60 150

outputFormat

Output a single integer which is the minimum number of meeting rooms required to schedule all the meetings without any overlap.

For example, the output for the sample input above is:

2
## sample
3
30 75
0 50
60 150
2