Software Engineer • Intern
Software Engineer • Intern
High QualityPrep Other Coding Questions Asked by Citadel
Continue with targeted prep from Citadel's coding question bank.
Interview Summary
The coding problem involved merging multiple timestamp-sorted market data feeds and calculating a running absolute price from the price changes in each event. The interviewer emphasized edge cases, particularly events with identical timestamps, negative price changes, and empty feeds.
Interview Details
Part I: Coding: Merge K Sorted Market Data Feeds
The interviewer presented a problem involving multiple streams of market data events. Given K data feeds, each feed contains events already sorted in ascending order by timestamp. Every event has two fields:
- Timestamp: The time associated with the event.
- Price Delta: The change in price caused by the event.
The task was to merge events from all feeds into a single chronological sequence. After processing each event, the program must output the current absolute price, starting from an initial price of 0. The absolute price is calculated as the running sum of all price deltas processed so far.
Follow-up 1 — Events with Identical Timestamps
One important follow-up involved handling events from different feeds that share the same timestamp. The interviewer required deterministic ordering, so events with identical timestamps must be processed using the following tie-breaking rules:
- Events with earlier timestamps are processed first.
- When timestamps are equal, events from the feed with the smaller feed index are processed first.
- If multiple events within the same feed share a timestamp, their original order within that feed must be
Unlock Full Details
Create a free account to unlock this interview experience report.