Detect A Currency Arbitrage Cycle From An FX Quote Matrix
Last updated: November 29, 2026
Quick Overview
Given executable FX conversion rates between currencies (after fees), determine whether some cycle of conversions returns more than you started with, and if so return one such cycle.
Point72
November 29, 20260
0
0 solved
Given executable FX conversion rates between currencies (after fees), determine whether some cycle of conversions returns more than you started with, and if so return one such cycle.
Point72 trades globally across FX and macro books, and engineers there are expected to translate a market concept into a graph algorithm. The interviewer wants the log transform that turns a product into a sum, Bellman-Ford negative cycle detection, and correct cycle extraction with floating point tolerance.
What the Interviewer Expects
- Transform rates with weight = -log(rate) so a profitable cycle becomes a negative cycle
- Run Bellman-Ford from a virtual source (all distances zero)
- Detect a relaxation in the n-th pass and walk parents n steps to land inside the cycle
- Extract and return the cycle in trading order
- Use an epsilon to avoid flagging rounding noise
- State O(V * E) and compare with Floyd-Warshall
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Quotes have size limits: how would you find the most profitable executable size?
- Rates update thousands of times per second: how would you avoid rerunning the full algorithm?
- Why is any detected arbitrage likely illusory in practice?
- How would you find the most profitable cycle rather than any profitable one?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Rates are directed and already include spread and fees, so rate(a, b) * rate(b, a) is usually slightly below 1. We need any cycle whose product of rates exceeds 1, returned as a list of currencies sta...
High-Level Design
Take weights w = -log(rate). A product above 1 means the sum of logs is positive, so the sum of weights is negative: arbitrage is exactly a negative cycle. Run Bellman-Ford with every distance initial...