Detect Currency Arbitrage with a Cycle Fee

You are given n currencies and an n × n matrix of positive floating-point exchange rates:

rates[i][j]

is the amount of currency j received for one unit of currency i.

A transact...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: