Dsa
Intervals
Easy
Longest Free Time Segment
Given a list of booked time intervals in 'HH:MM-HH:MM' format, find the longest free time segment available in the day from '00:00' to '23:59'. Print the segment in the same format.
Input:
- A single line containing space-separated booked intervals.
Output:
- A single line containing the longest free time segment in 'HH:MM-HH:MM' format.
Example:
Input:
09:00-10:00 10:30-11:30 13:00-14:00
Output:
00:00-09:00
Key concepts
intervalsmax segment
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