Dsa
Intervals
Easy
Find Continuous Availability
You are given a list of booked time slots for a resource (like a conference room). Your task is to find contiguous available time slots of a specified duration. The time slots are given in 24-hour format with minutes, and time runs from '00:00' to '23:59'.
Input Format:
- The first line contains two integers, n (the number of booked intervals) and d (the desired duration in minutes).
- The next n lines each contain two strings in 'HH:MM' format representing the start and end time of each booking.
Output Format:
- Print the available time slots in 'HH:MM HH:MM' format, with each slot on a new line. If no slot is available, print "No available slots".
Example:
Input:
2 30
09:00 09:30
10:00 11:00
Output:
09:30 10:00
Key concepts
intervalsavailabilityslots
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