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
Coding & Algorithms
Software Engineer
Wise
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

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
graph DP
Bellman-Ford
monotone functions
currency routing
path reconstruction
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample Answer
Requirements

Nodes are currencies; an edge u to v turns x units of u into (x(1−p)−f)⋅r(x(1-p) - f) \cdot r 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 −log⁡-\log weights. The fixed fee ruins that: the effect of an edge depends on how much you h...


Submit Your Answer
Markdown supported

Related Questions