Dsa
Intervals
Easy
The Peak Power Hour
A power grid monitors 'surge' intervals from different sectors. Each surge is an interval [start, end] where the end is inclusive. You need to find the maximum number of sectors experiencing a surge at any single point in time.
Input Format:
The first line contains N, the number of surge intervals.
The next N lines each contain two integers: start and end (inclusive).
Output Format:
Print the maximum number of overlapping surges.
Example:
Input:
3
1 5
2 6
5 8
Output:
3
(At time 5, all three surges overlap.)
Key concepts
sweep linecoordinate compression
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