Detect Dropped Telemetry Packets With Wrapping Sequence Numbers
Last updated: November 29, 2026
Quick Overview
Vehicle telemetry frames carry a 16-bit sequence number that wraps from 65535 back to 0. Given the sequence numbers in arrival order, return the ranges of frames that were never received.
Spacex
November 29, 20260
0
0 solved
Vehicle telemetry frames carry a 16-bit sequence number that wraps from 65535 back to 0. Given the sequence numbers in arrival order, return the ranges of frames that were never received.
A warm-up in the style of a SpaceX phone screen for flight software or ground software roles, where telemetry links from a rocket or Starlink satellite drop and reorder frames. The interviewer checks modular arithmetic, careful handling of wraparound and duplicates, and whether you ask about reordering before coding.
What the Interviewer Expects
- Ask whether frames can arrive duplicated or out of order before writing code
- Use modular difference rather than raw subtraction so 65535 to 0 is a step of one
- Pick an explicit rule for packets that look older than the last one seen
- Return ranges, not every missing number, so a long dropout stays cheap
- Run in a single O(n) pass with O(1) extra state besides the output
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you retract a reported gap when a late frame for it arrives a few milliseconds later?
- What breaks if more than 32768 frames are lost in one dropout, and how would timestamps help?
- How would you turn this into a streaming function that emits gaps as frames arrive?
- How would you report link quality (percent loss per second) to a mission control display?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: list of 16-bit sequence numbers in arrival order. Output: list of (first_missing, last_missing) ranges, inclusive, also expressed mod 65536. Duplicates are ignored. A frame whose forward dist...
High-Level Design
Keep prev, the last accepted sequence number. For each new value compute delta = (s - prev) mod 65536. delta == 0 is a duplicate. delta >= 32768 means it is behind us. delta == 1 is normal. ...