Dsa
Intervals
Medium
Max Overlapping Intervals
You are given a list of intervals. Your task is to find the maximum number of overlapping intervals and return that count.
Input Format:
- The first line contains an integer n, the number of intervals.
- The next n lines each contain two integers, l and r, representing the start and end of an interval (inclusive).
Output Format:
- Print a single integer representing the maximum number of overlapping intervals.
Example:
Input:
5
1 3
2 5
4 6
7 8
5 9
Output:
3
Key concepts
intervalsgreedysorting
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