Question bank › Intervals
Dsa Intervals Easy

Deep Space Silence

An interstellar radio array receives signals in specific time windows. You are given a list of time intervals [start, end] where signals were detected. Your task is to find the duration of the longest continuous period of 'silence' (no signals detected) between the first recorded signal's start time and the last recorded signal's end time. Input Format: The first line contains an integer N, the number of signal intervals. The next N lines each contain two integers, 'start' and 'end', representing a signal window. Output Format: Print a single integer representing the length of the longest silent gap. Example: Input: 3 10 20 50 60 25 35 Output: 15 (Gaps are [20, 25] length 5 and [35, 50] length 15. Longest is 15.)

Key concepts

sortinginterval gaps

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.