In Order Delivery Buffer for a Lossy Mesh Radio Link

Last updated: November 29, 2026

Quick Overview

Messages between aircraft arrive over a mesh radio with sequence numbers, possibly duplicated, reordered or lost. Implement a receiver that delivers payloads in sequence order, drops duplicates, and declares a missing sequence lost once more than W later messages are buffered.

Shield AI
Software Engineering Fundamentals
Software Engineer
Shield AI
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Messages between aircraft arrive over a mesh radio with sequence numbers, possibly duplicated, reordered or lost. Implement a receiver that delivers payloads in sequence order, drops duplicates, and declares a missing sequence lost once more than W later messages are buffered.

Hivemind agents coordinate over contested, low-bandwidth links where packets vanish, so the autonomy and networking teams care about receivers that make progress instead of stalling forever. The interviewer looks for a clear invariant, bounded memory, and reasoning about when giving up on a message is the right call.

What the Interviewer Expects
  • States the invariant: everything below `expected` is delivered or declared lost
  • Drops duplicates and already-skipped sequence numbers
  • Bounds the buffer by W and skips to the smallest buffered sequence
  • Delivers any newly contiguous run after a skip
  • Discusses wraparound of fixed-width sequence numbers
Key Topics to Cover
Reorder buffer
Sequence numbers
Bounded memory
Unreliable networks
Invariants
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • Sequence numbers are 16-bit and wrap. How do you compare them?
  • Should a stale position report be skipped while a mission command must be retransmitted? How would you support both?
  • How would you add a time-based timeout instead of a count-based window?
  • How would you test this against realistic radio loss patterns?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

receive(seq, payload) returns the list of (seq, payload) now deliverable, in order. Duplicates are ignored. If the gap at expected persists while more than window messages are waiting, the mis...

High-Level Design

Keep expected (the next sequence to deliver) and a dict pending of buffered out-of-order messages. Loop: if expected is buffered, deliver it and advance; else if the buffer exceeds the window, s...


Submit Your Answer
Markdown supported

Related Questions