#K59022. Minimum Meeting Rooms

    ID: 30772 Type: Default 1000ms 256MiB

Minimum Meeting Rooms

Minimum Meeting Rooms

You are given a list of meeting time intervals, each with a start time and an end time. Your task is to determine the minimum number of meeting rooms required so that all meetings can be scheduled without overlapping. Two meetings are considered non-overlapping if the start time of one is greater than or equal to the end time of the other.

Formally, given \( n \) meetings where each meeting \( i \) is represented by its start time \( s_i \) and end time \( e_i \), find the smallest number of meeting rooms required such that no two meetings in the same room overlap.
The challenge lies in efficiently handling overlapping intervals while minimizing resources.

inputFormat

The input is read from standard input (stdin). The first line contains an integer ( n ), the number of meetings. This is followed by ( n ) lines, each containing two space-separated integers representing the start time and the end time of a meeting.

outputFormat

Print a single integer to standard output (stdout) representing the minimum number of meeting rooms required to schedule all meetings.## sample

3
0 30
5 10
15 20
2