A quick note: this came from a real AWS phone-screen interview report. The report shared a currency-conversion graph, directed rates such as USD -> JPY, a from/to query, and a rounded numeric result in the example. FastPrep added only the small runnable examples and wording needed for practice, strictly from those visible details and stated rules. The core task should be a close match; exact wording may differ because the report was a short write-up. If we come across a fuller version later, we'll come back and update this.
rates = [["USD","JPY","110"],["USD","AUD","1.45"],["JPY","GBP","0.0070"]] query = ["GBP","AUD"] return = "1.89"
Use the reverse of JPY -> GBP, then the reverse of USD -> JPY, then USD -> AUD: (1 / 0.0070) * (1 / 110) * 1.45 = 1.883..., which rounds to 1.89.
Unlock the full problem
- Full problem statement and constraints
- 1 more worked example, explained
- Guided hints and editorial
- Run your code on real test cases
Pro subscription, billed yearly — or $19 month-to-month. Cancel anytime.
Unlock the full problem
- Full problem statement and constraints
- 1 more worked example, explained
- Guided hints and editorial
- Run your code on real test cases
Pro subscription, billed yearly — or $19 month-to-month. Cancel anytime.