Question bank › Intervals
Dsa Intervals Warm-up

Max Free Time

You are given a list of busy intervals during a day as pairs of integers [start, end]. Your task is to find and print the maximum gap (free time) between any two busy periods. Consider the end of one interval and the start of the next when identifying a gap. Input format: - The first line contains an integer n, the number of busy intervals. - The next n lines each contain two integers, start and end of the busy intervals. Output format: - Print the length of the maximum free time. Example: Input: 3 1 3 5 6 8 10 Output: 2

Key concepts

intervalsgapsscheduling

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.