#K336. Minimum Meeting Rooms

    ID: 25123 Type: Default 1000ms 256MiB

Minimum Meeting Rooms

Minimum Meeting Rooms

Given a list of meeting time intervals, each defined by a start time and an end time, determine the minimum number of meeting rooms required to schedule all the meetings without any overlapping in the same room.

A meeting can start at the same time another meeting ends. In other words, if a meeting starts at time \(t\), it can use a room whose previous meeting ended at time \(t\) (i.e., \(start \geq end\)).

The list of meetings is unordered. Your task is to find the least number of rooms needed to accommodate all meetings.

inputFormat

The first line contains an integer (N), representing the number of meetings. Each of the next (N) lines contains two space-separated integers representing the start and end times of a meeting.

outputFormat

Output a single integer representing the minimum number of meeting rooms required.## sample

3
6 7
2 4
8 12
1