HackTheRounds Interview Experiences
Hudson River Trading OA Interview Experience (2026) - Order Book Matching & Stock DP, Offer
HRT 2026 SWE OA walkthrough: Order Book Matching (two pointer greedy), Minimum Transformations for Unique Substrings, and Optimal Trade Execution (Best Time to
By Anonymous ยท 2026-04-13
Background
Hudson River Trading's 2026 software engineer OA landed in my inbox two days after I dropped my resume on their careers portal. I'm a CS senior with a year of HFT-adjacent internship experience at a smaller prop shop, and HRT has always been the dream shop on my list because of their C++ stack and how heavily they bias toward raw problem-solving. The OA itself is the classic CodeSignal experience with an HRT twist: trading-flavored problems wrapped around standard algorithmic patterns.
Timeline
- Application submitted: early March
- OA invite: 2 days later, 7-day window to start
- OA attempted: the following weekend
- Result: passed, onsite invite landed 5 business days after
- Total so far: ~3 weeks to onsite invite
I'll cover only the OA here since the onsite is a separate beast and deserves its own post.
OA Format (90 min, CodeSignal)
Three algorithmic problems, 90 minutes total. C++ and Python are both available. In my round all three problems were coding, no SQL, no multiple choice, no personality assessment. The problems lean market-themed (order books, execution, trade signals) but once you strip the flavor text, they reduce to standard patterns: two pointers, sliding window, and interval DP.
Problem 1: Order Book Matching
Problem: You are given a list of buy and sell orders, each encoded as [price, quantity, side] where side is either B or S . Match buys and sells greedily: a buy at price p matches any sell at price <= p. For each matched pair, the executed volume is min(buy qty, sell qty) . Return the total executed volume across all matches.
I split the list into two arrays: buys sorted by price descending, sells sorted by price ascending. Then two pointers walk through them. If the current buy's price is at least the current sell's price, record the pairwise min(qty) as executed volume, subtract it from both sides, and advance whichever side was exhausted. The moment the prices fail to cross, we stop: the remaining buys are all lower priced and the remaining sells are all higher priced.
O(n log n) for the sort, O(n) for the walk. The trap is assuming the greedy "highest buy matches lowest sell" is always optimal. It is, because executed volume only depends on pairwise min(qty) once the price cross is established, and the cross is preserved by our sort orders.
Problem 2: Minimum Transformations for Unique Substrings
Problem: Given a string s and an integer k , find the minimum number of character replacements so that every contiguous substring of length k has all distinct characters. You can replace any char with any lowercase letter.
This is a sliding window counting problem with a twist: the "minimum replacements" here is about each window having zero duplicates, and windows overlap so you can't treat them independently.
My approach was to slide a window of size k across s and, for each window, count duplicates. But you can't just sum duplicates across windows since shared characters double-count. I ended up computing, per window, the number of characters that appear more than once, and the total answer is the max over windows of those duplicate counts, not the sum. That observation is the key: you only need enough replacements in the worst window to fix it, because replacing a character with a fresh unused letter in that window can also break duplicates in neighboring windows.
Actually, the correct reduction is subtler. You need to pick replacement positions such that every window of size k has distinct chars. I treated it as: in each window, count duplicates as k - (number of distinct chars in window) . The answer is the sum of these across non-overlapping windows, OR the max if windows overlap, in my final submission I used a greedy per-window replacement from left to right and tracked which positions had been rewritten.
I got partial credit on this one. The clean solution likely uses a greedy scan with a frequency map that resets every k positions. I ran out of time to refactor and submitted with 11 of 15 test cases passing.
Problem 3: Optimal Trade Execution
Problem: Given an array prices[] of daily stock prices and an integer k , find the maximum profit achievable with at most k transactions, where you cannot hold more than one share at a time. A transaction is a buy followed by a later sell.
This is Best Time to Buy and Sell Stock IV, which is a canonical DP problem. Two cases:
- If `k >= n/2`, you can do as many transactions as you want, sum all positive price jumps `max(0, prices[i+1] - prices[i])`.
- Otherwise, run the 2D DP: `dp[t][i]` = max profit with at most t transactions by day i, holding no stock. Recurrence: `dp[t][i] = max(dp[t][i-1], prices[i] + max_j (dp[t-1][j-1] - prices[j]))` for `j <= i`. The inner max can be maintained incrementally so the whole thing is O(kn).
Verified mentally on prices=[3,2,6,5,0,3], k=2 which gives 7 (buy at 2 sell at 6 = 4, buy at 0 sell at 3 = 3, total 7). Full credit. It's a memorized pattern if you've ever done the 4 flavors of stock problems.
What I Learned From the OA
HRT's OA rewards finishing cleanly more than finishing cleverly. Problem 1 is a greedy two-pointer you can write in 10 minutes. Problem 3 is canonical DP. Problem 2 is the swing problem where you either saw the right reduction or you didn't. If you burn 45 minutes on Problem 2 and end up with partial credit, that's fine, that was me, as long as Problems 1 and 3 are fully correct.
Speed was a bigger factor than I expected. I burned the first 10 minutes reading all three prompts and planning the order to tackle them. In retrospect that was the right call: Problem 3 (DP) is the most templatey and I knocked it out first in 25 minutes, then Problem 1 in 15, and threw the rest at Problem 2.
Result
Passed the OA and got the onsite invite 5 business days later. The recruiter email mentioned I had full credit on two problems and partial on the third, which matched my self-assessment. Onsite loop is four rounds: two coding, one systems, one behavioral.
Tips
- Stock DP is free points. Memorize the 4 variants cold. HRT and every other quant shop pull from Best Time to Buy and Sell Stock I, II, III, IV. If you can write the O(kn) two-transaction DP from muscle memory, you save 20 minutes on the OA.
- For Problem 2-type "every window must satisfy X" problems, attempt the greedy left-to-right scan first. The optimal algorithm might be cleaner, but a correct greedy with position rewrites gets you 60-70% credit in a fraction of the time.
- Triage before you code. Read all three prompts up front, classify by pattern, attack the most templatey one first. HRT's OA is 90 minutes, and the penalty for leaving an easy problem untouched is far worse than spending 5 minutes planning.
- Use C++ if you know it. HRT bias aside, C++ gives you 2-3x headroom on tight time limits. If you are equally comfortable in both, default to C++. Both are offered.
- Test edge cases before you submit. n=1, n=0, k=0, all-equal prices, single buy/sell. Problem 3 has a specific trap at `k >= n/2` that's easy to forget.
- Don't gamble the second problem. If you have a greedy that passes samples and 10 minutes left, submit it. Don't rewrite for asymptotic improvement unless you're certain, HRT weights partial credit heavily.
HRT's OA is not a trick box. It is a speed and correctness test over classic patterns with trading flavor text. Prep the canonical problems, manage time, and you'll pass.