Dsa
Intervals
Warm-up
Find the Largest Gap between Intervals
Given a list of intervals, find the largest gap between the intervals. Each interval is represented as a pair of integers [start, end]. The gap is defined as the distance between the end of one interval and the start of the next one. The input ends with a single line containing 'end'. For example:
Input:
[1, 3]
[5, 10]
[12, 15]
end
Output:
2
Key concepts
intervalsgapsmax
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