#K2061. Minimum Meeting Rooms

    ID: 24653 Type: Default 1000ms 256MiB

Minimum Meeting Rooms

Minimum Meeting Rooms

You are given a list of meetings, each specified by a start time and an end time. Two meetings overlap if one meeting starts before the other finishes. The challenge is to determine the minimum number of meeting rooms required so that all meetings can be held without any overlap.

Mathematical Formulation: Given a set of time intervals \(\{[s_i, e_i]\}_{i=1}^n\), find the minimum number \(m\) such that each interval can be assigned to one of \(m\) rooms, with no two overlapping intervals assigned to the same room. In other words, \(m = \max_{t}\{\text{number of intervals covering } t\}\).

inputFormat

The input is provided via standard input. The first line contains an integer \(n\) representing the number of meetings. The next \(n\) lines each contain two space-separated integers \(s_i\) and \(e_i\) which represent the start and end times of a meeting.

outputFormat

Output a single integer to standard output: the minimum number of meeting rooms required to host all meetings without any overlap.

## sample
3
10 20
15 25
5 15
2

</p>