The first line of input contains an integer 'N', the number of intervals.
The next 'N' lines each contain two space-separated integers, start and end, representing an interval.
Print the isolated intervals, one per line, with the start and end values separated by a space.
The output intervals must be sorted in ascending order based on their start times.
If no isolated intervals exist, print a single line with the value -1.
Two intervals [s1, e1] and [s2, e2] are considered to overlap if s1 <= e2 and s2 <= e1. This means they also overlap if they just "touch" at an endpoint (e.g., [1, 5] and [5, 10]).
The most efficient way to solve this is to first sort all intervals by their start times. Then, for each interval, you only need to check for overlaps with its immediate neighbors in the sorted list.
Find the maximum element of each row
Find the maximum element of each row
Treasure Island Route
Largest Plus Sign
Minimum Operations to Form Letter Y
Matrix Block Sum