← Citadel Interview Insights

Citadel·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Apr 2026

Summary

Citadel software engineering interview with a meaty system design question around order book data structures. The kind of problem where you think you know the answer until they ask about cancellations.

Questions Asked (1)

Q1

Design a class that processes a stream of orders (exchange ID, price, quantity, order type as bid or ask) and supports two operations: fetching the best bid and ask for a specific exchange, and fetching the best bid and ask across all exchanges. Walk through your data structure choices, complexity, and how you'd handle cancellations or quantity updates.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

I went with a sorted structure per exchange, like a max-heap for bids and min-heap for asks, which felt right until they pushed on cancellations.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and assumptions, then propose a data structure that supports efficient per-exchange and global best bid/ask queries. Walk through the design, analyze time and space complexity, and discuss how to handle cancellations and quantity updates. Finally, mention potential optimizations and trade-offs.

Pro tip: Emphasize the importance of maintaining both per-exchange and global order books, and discuss how to handle updates efficiently without full recomputation. Showing awareness of real-world constraints like message ordering and latency will impress interviewers.

1. Clarify Requirements and Assumptions

Ask about expected message volume, latency requirements, and whether orders can be modified or canceled. Clarify if the stream is ordered and if exchanges are known in advance.

2. Design Data Structures

Propose a per-exchange order book using two heaps (max-heap for bids, min-heap for asks) or balanced BSTs for efficient best price retrieval. For global best, maintain a heap of best bids and asks across exchanges, updating lazily or eagerly.

3. Analyze Complexity

Discuss time complexity for insertions, cancellations, and best price queries. For heaps, insertion is O(log n), best is O(1), but cancellation requires lazy deletion. For BSTs, all operations are O(log n).

4. Handle Cancellations and Updates

Explain how to handle cancellations: use a hash map to track order IDs and mark them as canceled, then lazily remove from heaps when they reach the top. For quantity updates, treat as cancel and reinsert, or update in place if using a balanced BST.

5. Discuss Trade-offs and Optimizations

Compare heap vs. balanced BST approaches, considering memory and update frequency. Mention possible optimizations like maintaining a global heap with lazy updates, or using a skip list for concurrent access.

Key Points to Mention

  • Choice of data structures: heaps vs. balanced BSTs for order books
  • Lazy deletion for cancellations to avoid O(n) removal from heaps
  • Global best bid/ask maintenance using a heap of exchange bests
  • Time complexity: O(log n) for updates, O(1) for best price queries
  • Handling quantity updates as cancel and reinsert
  • Trade-offs between eager and lazy updates for global best

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.