Dsa
Intervals
Medium
Bus Schedule Conflicts
You are responsible for managing a bus schedule. Each bus has a start and end time. Your task is to find how many buses are scheduled simultaneously at any point in time and output the maximum number of concurrent buses.
Input Format:
- An integer n (1 ≤ n ≤ 1000), the number of buses.
- Followed by n lines, each containing two integers start and end (0 ≤ start < end ≤ 10^9).
Output Format:
- An integer representing the maximum number of concurrent buses.
Example:
Input:
4
1 5
2 3
3 6
4 8
Output:
3
Key concepts
intervalsconflictscounting
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