← Optiver Interview Insights

Optiver·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Optiver software engineer interview with a pretty gnarly algorithmic problem involving currency arbitrage. The twist with the transaction cost made it more interesting than your typical Bellman-Ford question.

Questions Asked (1)

Q1

Given a K×K matrix of currency exchange rates where R[i][j] represents how much of currency j you get per unit of currency i, determine if any cycle of exchanges produces a net profit after a 0.01% transaction cost applied once per completed cycle.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Classic arbitrage detection but the transaction cost modifier threw me for a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the exchange rates as a directed graph where edge weights are the negative logarithms of the rates, so that finding a profitable cycle reduces to detecting a negative-weight cycle. Apply the 0.01% transaction cost by adjusting each edge weight (e.g., subtract log(0.9999)) and then run the Bellman-Ford algorithm to check for negative cycles.

Pro tip: Mention that you would first clarify whether the transaction cost is applied per trade or per completed cycle, and whether the cycle must return to the starting currency. This shows attention to detail and avoids incorrect assumptions.

1. Clarify the problem

Confirm the exact meaning of the transaction cost (e.g., 0.01% deducted once per cycle) and whether the cycle must start and end with the same currency. Also check if the matrix is guaranteed to be consistent (e.g., R[i][j] * R[j][i] <= 1).

2. Transform to graph problem

Convert each exchange rate R[i][j] to an edge weight w(i,j) = -log(R[i][j]). A profitable cycle exists if the sum of weights around a cycle is negative after accounting for the transaction cost.

3. Incorporate transaction cost

Adjust each edge weight by adding -log(1 - 0.0001) (since 0.01% cost reduces the effective rate). Alternatively, subtract log(0.9999) from each edge weight to reflect the cost per trade, but ensure it's applied once per cycle.

4. Detect negative cycle

Run the Bellman-Ford algorithm from any node (or a super-source connected to all nodes) to detect a negative-weight cycle. If found, a profitable arbitrage opportunity exists.

5. Analyze complexity and trade-offs

Discuss time complexity O(K^3) and space O(K^2). Mention alternative approaches like Floyd-Warshall for all-pairs shortest paths, but note Bellman-Ford is sufficient for cycle detection.

Key Points to Mention

  • Negative cycle detection using Bellman-Ford
  • Logarithmic transformation to convert multiplication to addition
  • Transaction cost adjustment in the graph weights
  • Time and space complexity analysis
  • Handling floating-point precision issues
  • Edge cases: self-loops, zero or negative rates, disconnected graph

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.