Back to problems

Convert amounts between multiple currencies

Algorithm · Rippling · Hard

A collection of direct foreign-exchange quotes is given. A quote is a triple (u, v, r) meaning that one unit of currency u can be exchanged for r units of currency v. Quotes are directed: a quote from u to v does not imply a quote from v to u. Exchanges may be chained, and the effective conversion factor of a chain is the product of the rates along its edges. An empty chain is allowed, so any currency can be converted to itself with conversion factor $$1$$. You are also…

Checking your access…