cswork / libraryOpen practice workspace

Interview experiences · Two Sigma

Two Sigma Quantitative Software Engineer Interview Experience — Order-Matching HackerRank Then a Quant Systems Deep Dive

Tech screenInterviewed 2026-07

Round 1: HackerRank Coding — Stock Exchange / Order Matching The task was to implement buy/sell order matching: Buy side uses max priority. Sell side uses min priority. Match orders when the price can cross. Handle partial fills. Output trade records. Handle the remaining resting orders. Follow-ups: How to add more tests to increase confidence. Why my output didn't match the sample. How multiple…

Round 1: HackerRank Coding — Stock Exchange / Order Matching

The task was to implement buy/sell order matching:

  • Buy side uses max priority.
  • Sell side uses min priority.
  • Match orders when the price can cross.
  • Handle partial fills.
  • Output trade records.
  • Handle the remaining resting orders.

Follow-ups:

  • How to add more tests to increase confidence.
  • Why my output didn't match the sample.
  • How multiple orders at the same price should be ordered.
  • Should you use order ID, quantity, or arrival time for tie-breaking.
  • Why choose a heap.
  • Could you use a linked list, tree, or some other structure instead.
  • Is a heap really optimal.
  • What would you change with more time.
  • How to improve the final string concatenation and result aggregation.

The core of it wasn't just getting the happy path to run — it was really testing:

  • price-time priority;
  • deterministic ordering;
  • data structure trade-offs;
  • testing/debugging discipline.

Round 2: Experience / Quant Systems Deep Dive

The second interviewer, a senior one, first had me walk through my resume completely, then had me pick a genuinely complex problem to go deep on.

Tax-loss harvesting optimizer

  • Tax regions and binary variables.
  • Big-M.
  • MIQP.
  • Whether it's essentially branch-and-bound underneath.
  • Whether to do a continuous relaxation first.
  • Whether to use the relaxed solution to shrink the binary search space.
  • How short-term gain enters the utility function.
  • Whether to consider waiting for the holding period to convert to long-term.
  • Wash-sale constraints.
  • The difference between single-period and multi-period.

Multi-period asset-location backtest

  • Whether Monte Carlo paths are used.
  • Rebalancing cadence.
  • What metrics are being optimized.
  • How much historical data is used.
  • What data sources are used.
  • How to get through 30,000 optimizer runs.
  • Single machine or multiple machines.
  • Whether running each path on its own machine would be faster.
  • Shared inputs, serialization, and scheduling overhead.
  • The actual runtime per path.
  • How to profile the bottleneck.
  • Which enhancements didn't get done in time.

Role fit

Then at the end they asked directly:

  • Do you lean more toward pure software engineering or pure quant research?
  • Which side are you strongest at and most interested in?
  • Are you suited to the intersection of engineering and optimization research?

Comments

Nothing here yet.

Join in on CSWork →