Question bank › Intervals
Dsa Intervals Easy

First Missing Packet

A streaming client is receiving data packets representing byte ranges [start, end). You know the total file size is S bytes (the file covers range [0, S)). Given the list of received byte ranges, identify the very first byte index that is missing and has not been received yet. If the entire file is complete from [0, S), print 'COMPLETE'. Input Format: First line: Two integers S (total size) and N (number of packets). Next N lines: Two integers 'start' and 'end' (exclusive end). Output Format: The integer index of the first missing byte, or 'COMPLETE'. Example: Input: 100 3 0 10 20 30 10 15 Output: 15 (Bytes 0-14 are covered, but 15 is missing.)

Key concepts

interval sortingfinding 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.