Dsa
Intervals
Easy
Intersection Strength
In a social network, an 'event' is an interval $[S, E]$. The 'strength' of an event is the number of other events it overlaps with. Two events overlap if there is at least one point in time common to both (including boundaries). Given N events, find the maximum strength among them.
Input Format:
- An integer N.
- N lines, each with S and E.
Output Format:
- A single integer representing the maximum strength.
Example:
Input:
3
1 10
5 15
20 25
Output:
1
Explanation: Event 1 overlaps with Event 2. Event 2 overlaps with Event 1. Event 3 overlaps with nothing. Max strength is 1.
Key concepts
intervalsbinary-searchcounting
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