Dsa
Intervals
Medium
Meeting Room Allocation
You are given a list of meeting requests, each defined by a start and end time. Your task is to allocate rooms for the meetings such that the maximum number of meetings can be held without any overlap. Each meeting is represented as an interval [start, end). Return the maximum number of non-overlapping meetings you can allocate rooms for.
Input format: The first line contains an integer n (1 <= n <= 10^4), the number of meetings. The next n lines each contain two integers representing the start and end time of the meetings (0 <= start < end <= 24).
Output format: A single integer indicating the maximum number of non-overlapping meetings.
Example:
Input:
5
1 3
2 4
3 5
4 6
5 7
Output:
4
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