A directed graph has n nodes and edges[i] = [u, v, w], where weights may be negative. Return true if the graph contains a cycle whose total weight is negative, anywhere in the graph (not only reachable from node 0), and false otherwise.
- Try SPFA: Bellman-Ford with a queue of nodes whose distance just changed, starting with every node in the queue at distance 0
- Track how many edges the best path to each node uses; reaching
n edges means a negative cycle - A zero-weight cycle is not negative; a negative edge on its own is fine