Dsa
Intervals
Warm-up
Count Non-Overlapping Intervals
Given a list of intervals, count how many of them are non-overlapping. Each interval is represented as a pair of integers [start, end]. The input ends with a single line containing 'end'. For example:
Input:
[1, 2]
[2, 3]
[3, 5]
[4, 6]
end
Output:
3
Key concepts
intervalscountingnon-overlapping
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