Track Unfilled Gaps on a Multicast Market Data Feed

Last updated: November 29, 2026

Quick Overview

Packets on an exchange multicast feed carry increasing sequence numbers but can arrive late, duplicated, or not at all. Build a tracker that ingests sequence numbers and reports the ranges still missing, letting late packets fill holes.

DRW
Coding & Algorithms
Software Engineer
DRW
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Easy

0

0

0 solved


Packets on an exchange multicast feed carry increasing sequence numbers but can arrive late, duplicated, or not at all. Build a tracker that ingests sequence numbers and reports the ranges still missing, letting late packets fill holes.

Market data handlers at DRW must decide quickly whether a gap is a reorder that will heal or a real loss that needs a snapshot or retransmit request. The interviewer looks for a clean state machine, range bookkeeping that does not blow up on a large gap, and attention to duplicates.

What the Interviewer Expects
  • Keeps a next-expected counter for the in-order fast path
  • Stores gaps as ranges, not one entry per missing number
  • Splits a range correctly when a late packet lands inside it
  • Ignores duplicates without corrupting state
  • Gives O(1) for in-order packets and O(log g) for late ones
Key Topics to Cover
streams
interval bookkeeping
binary search
market data
state machines
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • When would you give up waiting and request a retransmit or snapshot?
  • How does this change with A and B feed lines that both carry the same packets?
  • What if the exchange resets sequence numbers at a session boundary?
  • How would you expose gap metrics so an operator can spot a flaky line?
Sharpen Your Skills on Codemia

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

Practice DSA Problems
Sample Answer
Requirements

Input is a stream of integer sequence numbers starting at a known first value. Output on demand is the list of inclusive ranges not yet received. A packet below next-expected is either a late fill or ...

High-Level Design

Hold next_expected and a sorted list of disjoint [lo, hi] gaps. In-order packets just bump the counter, which is the overwhelmingly common case. A jump ahead appends a new gap at the end, which ke...


Submit Your Answer
Markdown supported