Unlike pure-algorithm companies, quant firms like Hudson River Trading (HRT) test coding + math on two tracks in the OA: you write code and also do fast probability, expectation, and mental-math reasoning. This piece, organized from an oavoservice student's HRT OA debrief, explains the math and coding sections separately, with derivations and Python solutions—a systematic reference for quant job seekers grinding problems.
1. The HRT OA two-track structure
| Module | Format | Focus |
|---|---|---|
| Math | Multiple choice / fill-in | Probability, expectation, combinatorics, mental math |
| Coding | CodeSignal coding | Arrays, simulation, greedy |
Quant roles look for mathematical intuition + engineering implementation, both sharp. Math questions are usually tightly timed, rewarding fluency over slow on-the-spot derivation.
2. Math 1: coin-flip expectation
Problem
A fair coin is flipped repeatedly until the first heads. Find the expected number of flips.
Derivation
Let the expectation be E. On the first flip: 1/2 chance of heads (done in 1), 1/2 chance of tails (1 used, back to the initial state):
E = 1/2 · 1 + 1/2 · (1 + E)
E = 1 + 1/2 · E → E = 2
Answer: expectation is 2 flips. This is a direct application of the geometric distribution E = 1/p (p = 1/2).
3. Math 2: poker probability
Problem
From a standard 52-card deck, draw 5 cards at random. Find the probability of exactly two aces.
Derivation
Choose 2 of 4 aces, 3 of the remaining 48, divided by total combinations:
from math import comb
def prob_two_aces():
favorable = comb(4, 2) * comb(48, 3)
total = comb(52, 5)
return favorable / total # ≈ 0.0399
print(round(prob_two_aces(), 4)) # 0.0399
About 3.99%. Combinatorics questions reward fluency with the C(n,k) "select + complement" pattern.
4. Coding: market-making PnL simulation
Problem
Given a stream of orders (side, price, qty), simulate a market-making account's final cash and position PnL. A buy spends cash and adds position; a sell collects cash and reduces position.
Approach
Scan linearly, maintaining cash and position; at the end, value the position at the close price for total PnL.
def simulate_pnl(orders, close_price):
cash = 0
position = 0
for side, price, qty in orders:
if side == "BUY":
cash -= price * qty
position += qty
else: # SELL
cash += price * qty
position -= qty
# value the remaining position at the close price
return cash + position * close_price
Time complexity: O(n). Space complexity: O(1). This kind of problem tests translating business rules accurately into code—don't skip valuing the leftover position.
5. Prep strategy
- Math: master expectation (geometric/linearity), conditional probability, combinatorics, Bayes—drill until you answer mentally in seconds.
- Coding: mainly arrays, prefix sums, simulation, greedy; write clean code under time pressure.
- Recommended LeetCode: 53 (max subarray), 238 (product except self), 56 (merge intervals) as a base.
FAQ
Q1: How hard is the HRT OA math?
Mostly undergraduate probability/statistics level, but tightly timed and fluency-driven. The focus is expectation, conditional probability, and combinatorics—built on regular practice, not on-the-spot grinding.
Q2: Which matters more, coding or math?
Both must be sharp. Math filters out weak quantitative intuition; coding filters out weak engineering. Quant roles especially value math, but failing the coding still means out.
Q3: What if mental math runs out of time?
Burn high-frequency formulas (geometric E=1/p, linearity of expectation, complement counting) into muscle memory, practice with a timer, and minimize derivation steps.
Q4: Can you prepare without a quant background?
Yes. Work systematically through probability/expectation + combinatorics, pair it with an array/simulation coding track, and progress on a weekly plan—most CS backgrounds can close the quantitative gap.
Preparing for the HRT OA?
The HRT OA is dual-track math + coding with a fast pace. oavoservice offers full-process HRT practice: timed drills on probability/expectation and combinatorics mental-math banks, a market-making simulation / array coding track, and question-type prediction plus time-management polishing by quant role. Coaches have quant-research and big-tech engineering backgrounds and help you max out both intuition and code stability.
Add WeChat Coding0201 now to get HRT questions and mock practice.
Contact
- WeChat: Coding0201
- Email: [email protected]
- Telegram: @OAVOProxy