Dsa
Intervals
Easy
Disjoint Interval List
Given a list of possibly overlapping intervals, merge all overlapping intervals and return a list of disjoint intervals. Each interval is represented by a pair of integers (start, end). If there are no intervals to merge, return them as is.
Input:
N
start1 end1
start2 end2
...
Output:
List of merged intervals in the format [ (start1, end1), (start2, end2), ...].
Example:
Input:
4
1 3
2 4
5 7
6 8
Output:
[(1, 4), (5, 8)]
Key concepts
intervalsmergingoutput formatting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now