DRW Coding Interview Questions
25 DRW coding interview problems with full optimal solutions — 8 easy, 12 medium, 5 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an DRW interviewer values, and a FAQ section.
Showing 18 problems of 25
- #4hardfrequently asked
4. Median of Two Sorted Arrays
DRW uses this as a pure algorithmic-difficulty benchmark — O(log(min(m,n))) via binary search on the smaller array. The connection to trading is direct: computing the combined median bid-ask spread from two sorted venue feeds without merging them. Sub-O(n) is the only acceptable answer.
- #15mediumfrequently asked
15. 3Sum
DRW asks 3Sum to test whether candidates can combine sorting with two-pointer sweeps and suppress duplicates without extra memory. In trading contexts this pattern appears in three-asset arbitrage detection: find all triplets of prices summing to zero profit after costs.
- #20easyfrequently asked
20. Valid Parentheses
DRW surfaces Valid Parentheses as a proxy for expression-tree reasoning — a skill that maps directly to parsing FIX protocol tags, validating order-routing rule expressions, and interpreting nested config syntax in trading systems.
- #21easyfrequently asked
21. Merge Two Sorted Lists
DRW uses Merge Two Sorted Lists as a building block — it is the O(n+m) merge step inside merge-sort, inside merge-k-sorted-lists, inside order-book consolidation. Get this right cleanly and quickly; interviewers use it to see pointer discipline before escalating to the k-way variant.
- #42hardfrequently asked
42. Trapping Rain Water
DRW uses Trapping Rain Water as a signal-processing proxy: the 'trapped water' at each bar is analogous to the gap between realized P&L and the maximum achievable — a measure of strategy drag bounded by the maximum left and right extrema. Two-pointer O(n) is the expected answer; DRW wants to see the transition from O(n) space to O(1).
- #49mediumfrequently asked
49. Group Anagrams
DRW uses Group Anagrams to test hash-key design — the skill of choosing a canonical representation that correctly groups equivalent items. In trading systems this appears in instrument deduplication: grouping ticker aliases (GOOG / GOOGL, different listings of the same underlying) by a canonical identifier.
- #53easyfrequently asked
53. Maximum Subarray
DRW frames Maximum Subarray as a drawdown-analysis problem: find the contiguous period with the maximum cumulative return. Kadane's algorithm is the expected answer — and DRW will ask you to extend it to track the actual window start and end indices, then to compute it over a live return stream.
- #56mediumfrequently asked
56. Merge Intervals
DRW frames Merge Intervals as an order-book depth aggregation problem: given a set of bid or ask price-quantity intervals, collapse overlapping ranges into consolidated depth levels. Sorting by start time is mandatory; the merge sweep is O(n).
- #66easyfrequently asked
66. Plus One
DRW uses Plus One to probe carry-propagation logic — a primitive that appears in arbitrary-precision integer arithmetic, price tick increments, and sequence-number rollover in market-data protocols. The edge case of all-nines reveals whether you think about overflow by default.
- #70easyfrequently asked
70. Climbing Stairs
DRW uses Climbing Stairs to probe whether candidates recognize Fibonacci-structure recurrences and immediately space-optimize. The follow-up — counting paths under a step-size constraint — mirrors the combinatorics in option-path counting and lattice models.
- #139mediumfrequently asked
139. Word Break
DRW surfaces Word Break to test DP on string segmentation — a pattern that maps to parsing FIX tag-value sequences and tokenizing structured market messages where the dictionary of valid tokens is known in advance.
- #200mediumfrequently asked
200. Number of Islands
DRW uses Number of Islands as a graph traversal proxy — the same connected-component logic appears in counterparty exposure clustering and in detecting isolated market segments. BFS and DFS both work; interviewers ask you to compare them on memory use.
- #206easyfrequently asked
206. Reverse Linked List
DRW asks Reverse Linked List to test pointer manipulation under pressure — a skill that maps to low-level ring-buffer and lock-free queue implementations used in market-data feed processing.
- #207mediumfrequently asked
207. Course Schedule
DRW uses Course Schedule to probe topological sort and cycle detection — the same logic used in dependency resolution for trading system component startup ordering and in detecting circular position-dependency chains in risk models.
- #238mediumfrequently asked
238. Product of Array Except Self
DRW uses this problem to test prefix-product reasoning without division — the same technique used to compute portfolio-weight normalization factors and running exposure metrics without re-scanning the full array. The O(n) no-division constraint is the key DRW signal.
- #322mediumfrequently asked
322. Coin Change
DRW uses Coin Change to test unbounded knapsack DP — and immediately connects it to tick-size discretization: given a set of valid price increments (tick sizes), what is the minimum number of ticks to express an order quantity? The greedy approach fails for arbitrary denominations; DP is required.
- #347mediumfrequently asked
347. Top K Frequent Elements
DRW asks Top K Frequent Elements to probe heap vs. bucket-sort trade-offs — decisions that matter when ranking the k most-traded instruments by volume or the k most-active order IDs in a session. O(n log k) with a heap is expected; O(n) with bucket sort earns extra credit.
- #1235hardfrequently asked
1235. Maximum Profit in Job Scheduling
DRW asks this problem because it is structurally identical to optimal trade-scheduling with non-overlapping execution windows: given a set of potential trades each with a start time, end time, and expected profit, select a non-overlapping subset that maximizes total profit. Weighted interval scheduling with binary search is the expected approach.