C++ coding problem: merging dual market-data feeds with minimal latency
This is an easy C++ coding problem designed to test your ability to consume and synchronize dual redundant data streams in a quantitative trading environment. It mirrors a real workflow at high-frequency trading firms, where microseconds matter and exchange feeds occasionally lag or drop packets.
The core challenge is to pull packets from two asynchronous sources, track them by sequence number, and emit an "earliest actionable stream" that always picks the fastest arrival for each sequence. You must handle missing packets, stream outages, tie-breaking rules, and the constraint that your output must be maximal—excluding no valid sequence numbers simply because one feed delivered them early. The solution rewards careful state management and clear handling of edge cases over raw performance.
- Merging multiple ordered streams
- Sequence numbering and gap handling
- Priority queues and comparators
- Stream synchronization logic