Question
A trading desk has a matrix rates where rates[i][j] is how many units of currency j you get for one unit of currency i (rates[i][i] = 1, and rates[i][j] <= 0 means no direct conversion). An arbitrage opportunity exists if you can start with one unit of some currency, convert through a sequence of currencies, and return to the start with strictly more than one unit. Return True if any such opportunity exists, otherwise False. There are at most 50 currencies.
has_arbitrage(rates: list[list[float]]) → bool[[[1,2],[0.6,1]]]outtrueState your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.