#C2347. Maximum Non-Overlapping Meetings
Maximum Non-Overlapping Meetings
Maximum Non-Overlapping Meetings
You are given a list of meetings with their start and end times. Your task is to determine the maximum number of meetings that can be scheduled without any overlap. Two meetings are considered non-overlapping if the start time of one is greater than or equal to the end time of the previous meeting.
The problem can be modeled as the classic interval scheduling maximization. One well known greedy strategy is to always select the meeting that ends the earliest. In mathematical terms, if a meeting is represented by an interval \([s_i, e_i]\), then we sort the meetings by \(e_i\) (end times) and select meetings iteratively such that for each selected meeting \(i\) with end time \(e_i\), the next meeting \(j\) must satisfy \(s_j \ge e_i\).
inputFormat
The first line contains a single integer \(n\) representing the number of meetings. Each of the next \(n\) lines contains two integers separated by space: the start time and end time of a meeting.
It is guaranteed that \(n \ge 0\) and the times are given in integer format.
outputFormat
Output a single integer representing the maximum number of non-overlapping meetings that can be scheduled.
## sample5
9 10
11 12
10 11
10 12
12 13
4
</p>