Dsa
Intervals
Warm-up
Merge Overlapping Intervals
Given a list of intervals, merge all overlapping intervals and return the resulting non-overlapping intervals as a list. Each interval is represented as a pair of integers [start, end]. The input ends with a single line containing 'end'. For example:
Input:
[1, 3]
[2, 6]
[8, 10]
[15, 18]
end
Output:
[[1, 6], [8, 10], [15, 18]]
Key concepts
intervalsmergesorting
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