Citadel logo

Citadel Medium Interview Questions

14 medium-level practice questions for Citadel technical interviews

Citadel software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Medium Verified Question #1

1. DAG Order Validator


Category: Topological sort coding problem

DAG Order Validator Given a Directed Acyclic Graph (DAG) and a list of nodes, determine if the list represents a valid topological sort...

Input: Graph (nodes and edges)
Output: Computed result
coding Medium Verified Question #2

2. Expression Evaluator


Category: String coding problem

Expression Evaluator You need to design and implement an expression evaluator that parses and computes mathematical expressions formatted in...

Input: String
Output: Computed result
coding Medium Verified Question #3

3. Knight Moves on Phone


Category: String coding problem

Knight Moves on Phone This problem is split into two parts.

Input: List
Output: Integer
coding Medium Verified Question #4

4. Price Change Aggregator


Category: Algorithm coding problem

Price Change Aggregator You are building a system to aggregate price updates from multiple feeds to reconstruct the price history of an asset.

Input: List
Output: Computed result
coding Medium Verified Question #5

5. Social Network Friend Suggester


Category: Array coding problem
Build a friend recommendation system for a social network. Given n users (indexed 0 to n - 1) and a list of existing friendships (undirected...
Input: Array
Output: Array
coding Medium Verified Question #6

6. Minimum Sum Tree Path


Category: Binary tree coding problem

Minimum Sum Tree Path

Input: Binary tree
Output: Computed result
coding Medium Verified Question #7

7. Dial Pad Knight Paths


Category: Algorithm coding problem

Dial Pad Knight Paths

Input: Number(s)
Output: Integer
coding Medium Verified Question #8

8. Sliding Window Top K


Category: Sliding window coding problem

Sliding Window Top K

Input: Array of integers
Output: Computed result
coding Medium Verified Question #9

9. Price Stream Merger


Category: Heap-based coding problem

Price Stream Merger

Input: List
Output: Computed result
coding Medium Verified Question #10

10. Closest Point Pair


Category: Algorithm coding problem

Closest Point Pair

Input: List
Output: Integer
coding Medium Verified Question #11

11. [CodeSignal] Common Free Slot


Category: Interval-based coding problem

[CodeSignal] Common Free Slot

Input: List
Output: Computed result
coding Medium concurrency #1

1. [Concurrency] — Implementing a Thread-Safe In-Memory Order Book

Background: Citadel operates in the finance sector, where a high-performance order book is crucial for trading. Properly managing orders in a concurrent environment without losing data integrity is essential.
Problem statement: Implement a thread-safe in-memory order book that can handle incoming orders and allow retrieval of current orders. You need to ensure that multiple threads can add, remove, and view orders without data corruption. Use a data structure for storing orders, ensuring that concurrent modifications don't lead to inconsistent views of the orders.
Function/class signature:
  • class OrderBook:

  • def add_order(order_id: str, price: float, quantity: int) -> None: Adds an order to the order book.

  • def remove_order(order_id: str) -> bool: Removes an order from the order book by order ID.

  • def get_current_orders() -> List[Dict[str, Union[str, float, int]]]: Returns a list of current orders.

Example 1:
Input: add_order("123", 100.0, 5)
Output: None
Explanation: Adds an order with ID "123", price 100.0, and quantity 5.
Example 2:
Input: remove_order("123")
Output: True
Explanation: Removes the order with ID "123" successfully.
Constraints:
  • Order ID is a unique string.

  • Price is a positive float.

  • Quantity is a positive integer.

  • The maximum number of orders is 1,000,000.

  • The solution must be thread-safe.
coding Medium dynamic programming #2

2. Dynamic Programming — Longest Consecutive Sequence

Background: Citadel deals with a vast amount of data and needs to identify patterns quickly for data analysis and decision-making. Finding the longest consecutive sequence in a dataset could play a vital role in financial modeling and forecasting.
Problem statement: You are given an unsorted array of integers. Your task is to find the length of the longest consecutive elements sequence. The consecutive elements can be from any range of numbers. You need to return the length of this sequence.
Function/class signature:
  • def longest_consecutive(nums: List[int]) -> int:


Example 1:
  • Input: nums = [100, 4, 200, 1, 3, 2]

  • Output: 4

  • Explanation: The longest consecutive sequence is [1, 2, 3, 4], which has a length of 4.


Example 2:
  • Input: nums = [0, 3, 7, 2, 5, 8, 4, 6, 1]

  • Output: 9

  • Explanation: The longest consecutive sequence is [0, 1, 2, 3, 4, 5, 6, 7, 8], which has a length of 9.


Constraints:
  • 0 <= nums.length <= 10^4

  • -10^9 <= nums[i] <= 10^9
coding Medium graph #3

3. Graph — Find minimum number of steps to reach the target node

Background: In financial modeling and algorithmic trading, Citadel needs to navigate data structures efficiently for optimal decision-making. This problem relates to traversing market data represented in a graph.
Problem statement: Given a directed graph represented as an adjacency list, find the minimum number of edges required to reach from a start node to a target node. Consider each edge represents a possible market movements. The goal is to help traders optimize their strategies by determining the quickest route through the data structure.
Function/class signature:
  • def min_steps(graph: List[List[int]], start: int, target: int) -> int:

Example 1:
Input: graph = [[1,2],[2],[3],[4],[]], start=0, target=4
Output: 3
Explanation: 0 -> 1 -> 2 -> 4 requires 3 steps.
Example 2:
Input: graph = [[1],[2],[3],[4],[5],[]], start=0, target=5
Output: 5
Constraints:
  • The graph will have at most 100 nodes.

  • Each node will have at most 10 outgoing edges.

  • 0 <= start, target < 100

  • The input graph is zero-based indexed.

Start practicing Citadel questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free