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
November 29, 20260
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
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
- 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 ProblemsSample 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...