Dsa
Backtracking
Medium
Meeting Room Schedule
In an office, meeting rooms need to be scheduled without overlapping to maximize their utility. Given a list of meetings, each defined by a start and end time, your task is to generate all valid combinations of meeting schedules that can fit within one meeting room. Each meeting room can hold one meeting at a time, and meetings cannot overlap.
Input Format:
- The first line contains an integer n (1 ≤ n ≤ 15), the number of meetings.
- The next n lines each contain two integers, start_time and end_time, where 0 ≤ start_time < end_time ≤ 24.
Output Format:
- Print each valid schedule combination, one per line, showing the meetings by their indices. If no valid schedules exist, print 'No valid schedules exist.'
Example:
Input:
4
1 3
2 5
4 6
5 8
Output:
[[0, 2], [0, 3]]
[[1, 2]]
Key concepts
backtrackingintervalsgreedy
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