840. Class Timings
0
Medium
Alice, a teacher at a primary school, needs to schedule class timings without any overlap. She has an array of intervals, where each interval represents the start and end time of a class. Your task is to merge any overlapping intervals and return the non-overlapping intervals.
Input Format
The first line contains an integer N, representing the number of intervals.
The next N lines contain the start and end times of each class interval.
The next N lines contain the start and end times of each class interval.
Output Format
Print each non-overlapping interval on a new line.
Example
Input
4
1 3
2 6
8 10
15 18
Output
1 6
8 10
15 18
Constraints
1<= N <= 104
1 <= start[i] , end[i] <= 104 for each ith interval
1 <= start[i] , end[i] <= 104 for each ith interval
Loading...
View Submissions
Console