Reported September 2026
Amazongraph

Currency Conversion Rate

Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Amazon OA. Under 2s to a working solution.
Founder's read

Amazon reported this one in September 2026, and it looks friendlier than it is. You get a list of currency pairs with rates, and a query like GBP to AUD that needs a chain of conversions, some of them reversed. It's a graph problem wearing a finance costume. Edges carry multipliers, and the answer is the product along a path. If the OA lands in your inbox this week, know the shape before you open it. StealthCoder sits invisibly on your screen as a safety net if you blank mid-assessment, but the pattern below is simple enough to carry in your head.

The problem

You are given currency conversion rates. Each row contains a source currency, a target currency, and the value of one unit of the source currency in the target currency.
A conversion may use multiple rates. A listed rate may also be used in reverse by taking its reciprocal.
Given a query [from, to], return the conversion rate from from to to, rounded and formatted with exactly two digits after the decimal point. Every judged query is connected by the supplied rates.

Function
findConversionRate(rates: String[][], query: String[]) → String

Examples
Example 1
rates = [["USD","JPY","110"],["USD","AUD","1.45"],["JPY","GBP","0.0070"]]
query = ["GBP","AUD"]
return = "1.88"
Use the reverse of JPY -> GBP, then the reverse of USD -> JPY, then USD -> AUD: (1 / 0.0070) * (1 / 110) * 1.45 = 1.883116.... Rounded to two decimal places, the result is 1.88.
Example 2
rates = [["USD","CAD","1.30"],["CAD","EUR","0.70"]]
query = ["USD","EUR"]
return = "0.91"
One USD is 1.30 CAD, and one CAD is 0.70 EUR, so the rate is 1.30 * 0.70 = 0.91.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Treat each currency as a node. For every row, add an edge from source to target with the rate, and a reverse edge with 1/rate. Then run BFS or DFS from the query's from currency, carrying the running product. When you hit the target, return that product formatted to two decimals. The input says every judged query is connected, so you don't need a no-path case. Brute force is trying all orderings of rates, which blows up fast. A visited set keeps you linear in nodes plus edges. Pitfalls: forgetting the reciprocal edge, which breaks Example 1, and formatting. Use fixed two-decimal formatting, not manual rounding. Also handle from equal to to by returning 1.00 if it appears. If you freeze on the live OA, StealthCoder can hand you the traversal while you keep your head clear.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Currency Conversion Rate cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as evaluate division. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Amazon's OA.

Amazon reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Currency Conversion Rate FAQ

What's the trick in the Amazon currency conversion rate problem?+

Build a graph where each currency is a node and each rate is a weighted edge. Add the reciprocal as the reverse edge. Then traverse from the source currency, multiplying rates along the way, until you reach the target. That product is your answer.

Should I use BFS, DFS, or union-find?+

BFS or DFS both work fine. Either carries a running product and stops at the target. Weighted union-find also works but is fiddlier to write under pressure. Pick the traversal you can code without bugs. Since queries are guaranteed connected, you don't need to handle missing paths.

Does the path I choose change the answer?+

In principle no. The rates are meant to be consistent, so any path between two currencies gives the same product, aside from tiny floating point drift. Take the first path you find. You don't need shortest path or best rate logic here.

How do I format the output correctly?+

Return a string with exactly two digits after the decimal point. Use your language's fixed-precision formatter, like a format string with two decimals, rather than rounding manually. Example 1 gives 1.883116... and must come out as 1.88, and Example 2 gives 0.91.

How do I prepare for this in 48 hours?+

Write one graph traversal with a weighted adjacency map from scratch, including the reciprocal edge. Run both examples by hand and in code. Then try a case where the query currency equals the target. That covers the pattern. Parsing strings to floats and formatting output are the usual small slips.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Amazon.

OA at Amazon?
Invisible during screen share
Get it