Maximise Recipient Amount Over Multi-Hop Currency Routes With Fees
Last updated: November 29, 2026
Quick Overview
Given conversion edges between currencies, each with a rate, a percentage fee and a fixed fee charged in the source currency, find the route of at most K conversions that delivers the most target currency for a given send amount, and return the path.
Wise
November 29, 20260
0
0 solved
Given conversion edges between currencies, each with a rate, a percentage fee and a fixed fee charged in the source currency, find the route of at most K conversions that delivers the most target currency for a given send amount, and return the path.
Wise does not always convert directly: liquidity and partner pricing can make GBP to USD to PLN cheaper than GBP to PLN. This onsite problem checks whether a candidate sees that fixed fees break the classic negative-log-weight trick and can still find a correct algorithm with a clear argument.
What the Interviewer Expects
- Notices that fixed fees make edge cost depend on the amount, so log-weight shortest path does not apply directly
- Observes each edge function is monotone increasing in the input amount
- Uses hop-bounded dynamic programming (Bellman-Ford by rounds) and argues why keeping only the best amount per currency per round is safe
- Reconstructs the path and handles unreachable targets
- Uses Decimal for money and discusses cycle and arbitrage behaviour
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
- If there were no fixed fees, how would you solve it faster and why?
- What happens if a cycle is profitable, and how would you detect it?
- How would you incorporate per-corridor delivery time as a second objective?
- The amount is only known at quote time: what could you precompute?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Nodes are currencies; an edge u to v turns x units of u into units of v. Find the best amount of dst reachable from amount of src within max_hops edges, plus the path. I...
High-Level Design
With only percentage fees each edge multiplies the amount, so maximising a product becomes a shortest path on weights. The fixed fee ruins that: the effect of an edge depends on how much you h...