Dsa
Intervals
Medium
Interval Removal
Given a list of intervals, filter out intervals that are completely covered by another interval. Return the remaining intervals.
Input Format:
- The first line contains an integer n, the number of intervals.
- The next n lines each contain two integers, l and r for the interval bounds.
Output Format:
- Print the remaining intervals as a list of tuples.
Example:
Input:
5
1 4
2 3
3 5
5 6
7 8
Output:
[(1, 4), (5, 6), (7, 8)]
Key concepts
intervalsfilteringoverlap
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