Question bank › Intervals
Dsa Intervals Easy

Data Patchwork

A file of total size L is being downloaded in N fragments. Each fragment covers a range $[S, E]$. Due to network errors, some parts of the file might be missing. Find the size of the largest contiguous missing block of data in the range $[0, L]$. Input Format: - Two integers: L (total file size) and N (number of fragments). - N lines, each containing S and E. Output Format: - A single integer representing the size of the largest missing gap. Example: Input: 100 2 10 20 30 45 Output: 55 Explanation: Missing blocks are [0,10], [20,30], and [45,100]. Their sizes are 10, 10, and 55. The largest is 55.

Key concepts

intervalsmerginggaps

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.