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
codingMediumVerified 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
codingMediumVerified 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
codingMediumVerified 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
codingMediumVerified Question#5
5. Social Network Friend Suggester
Category: Array coding problemBuild 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
codingMediumVerified Question#6
6. Minimum Sum Tree Path
Category: Binary tree coding problem
Minimum Sum Tree Path
Input: Binary tree Output: Computed result
codingMediumVerified Question#7
7. Dial Pad Knight Paths
Category: Algorithm coding problem
Dial Pad Knight Paths
Input: Number(s) Output: Integer
codingMediumVerified Question#8
8. Sliding Window Top K
Category: Sliding window coding problem
Sliding Window Top K
Input: Array of integers Output: Computed result
codingMediumVerified Question#9
9. Price Stream Merger
Category: Heap-based coding problem
Price Stream Merger
Input: List Output: Computed result
codingMediumVerified Question#10
10. Closest Point Pair
Category: Algorithm coding problem
Closest Point Pair
Input: List Output: Integer
codingMediumVerified Question#11
11. [CodeSignal] Common Free Slot
Category: Interval-based coding problem
[CodeSignal] Common Free Slot
Input: List Output: Computed result
codingMediumconcurrency#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:
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
codingMediumgraph#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: