Dsa
Intervals
Easy
Deep Work Slot Finder
You are given a workday range [W_start, W_end] and a list of booked meetings [start, end]. You need to find the FIRST available gap in the schedule that is at least K minutes long. If a gap is found, output its start and the time it would end (start + K). If no such gap exists, output 'NONE'.
Input Format:
- Line 1: W_start W_end (Workday boundaries).
- Line 2: N (Number of meetings).
- Next N lines: Meeting start and end times.
- Last line: K (Minimum required slot duration).
Output Format:
- Two space-separated integers (start and end) or 'NONE'.
Example:
Input:
900 1700
2
1000 1100
1300 1400
60
Output:
900 960
(Explanation: The first gap is [900, 1000], which is 100 mins. We need 60, so we start at 900 and end at 960.)
Key concepts
interval inversesearching
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