#K42462. Minimum Days for Scheduling Events
Minimum Days for Scheduling Events
Minimum Days for Scheduling Events
Given a list of events defined by their start and end times, determine the minimum number of days required to schedule all events such that no two overlapping events occur on the same day.
Each event is represented by a pair of integers (s) and (e), where (s) is the start time and (e) is the end time. Two events are considered non-overlapping if the end time of one event is less than or equal to the start time of another event. Use a greedy algorithm with a min-heap to achieve optimal scheduling.
inputFormat
The first line contains an integer (n), the number of events. Each of the following (n) lines contains two space-separated integers (s) and (e), representing the start and end times of an event.
outputFormat
Output a single integer representing the minimum number of days required to schedule all events without overlaps.## sample
3
1 3
2 5
4 6
2