Foreign exchange (FX) market makers continually scan inter-bank currency quotes for cross-rate pricing inefficiencies. You are given a list of currency names and a matrix rates where rates[i][j] specifies the conversion rate from currency to currency (1 unit of currency yields rates[i][j] units of currency ).
An arbitrage opportunity exists if there is a cycle of conversions such that the compounding product of exchange rates strictly exceeds :
Your Task
Implement has_arbitrage_opportunity(rates: list[list[float]]) -> bool that detects whether any currency arbitrage cycle exists.
Constraints
Examples
rates = [
[1.0, 0.85, 0.75],
[1.18, 1.0, 0.88],
[1.34, 1.14, 1.0]
]
# 0 -> 1 -> 2 -> 0: 0.85 * 0.88 * 1.34 = 1.00232 > 1.0 (arbitrage!)
# Output: True