Question bank › Intervals
Dsa Intervals Medium

Meeting Room Allocator

You are tasked with scheduling meetings in a conference room. Each meeting has a start and end time, and no two meetings can overlap. Given a list of meetings, your goal is to maximize the number of non-overlapping meetings that can take place in the conference room. You will be given the number of meetings followed by the start and end times of each meeting. Each meeting will be given in the format "start end" (e.g. "1 3" for a meeting that starts at time 1 and ends at time 3). Your program should read the input and print the maximum number of non-overlapping meetings that can be accommodated. Input Format: - The first line contains an integer n (1 <= n <= 1000), the number of meetings. - The next n lines each contain two integers, the start and end times of each meeting, respectively (0 <= start < end <= 24). Output Format: - A single integer representing the maximum number of non-overlapping meetings. Example: Input: 3 1 4 2 3 4 5 Output: 3

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.