Dsa
Intervals
Easy
Free Time Between Meetings
Your task is to find free time slots in a day, based on the list of meetings scheduled. You need to identify all gaps between scheduled meetings that are longer than a specified threshold. Print these free time slots in the format (start, end).
Input Format:
- The first line contains an integer n (1 <= n <= 100) - the number of meetings scheduled.
- The next n lines each contain two integers: the start and end of each meeting.
- The last line contains an integer k (1 <= k <= 24) - the threshold for the minimum length of free slots (in hours, from 0 to 24).
Output Format:
- Print each free slot longer than k hours in the format 'start end'.
Example:
Input:
3
9 11
12 14
16 18
2
Output:
11 12
14 16
Key concepts
intervalsschedulinggaps
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