Given a table of currency exchange rates as a 2-D array, determine whether there is a possible arbitrage opportunity: a sequence of trades starting with amount X of any currency that ends with more than X of that currency. Input: first line n (number of currencies), then n lines each with n exchange rates (rate[i][j] = currency i to j). Output "true" or "false".
Example 1:
Example 2:
Constraints:
1 <= n <= 100 0 < rate[i][j] <= 10^6 rate[i][i] = 1.0
Tags:
