Dsa
Intervals
Easy
Classroom Overlap
You are given a schedule of classes in a day, where each class is represented by a start and end time. Your task is to find how many classes overlap at any given time. The input consists of an integer n (the number of classes) followed by n pairs of integers (the start and end times of each class). Output the maximum number of overlapping classes at any point in time. Example: Input: 4
1 3
2 4
3 5
4 6
Output: 2
Key concepts
intervalscountingsorting
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