Critical connections
A network of n servers (labeled 0..n-1) is connected by undirected connections, where connections[i] = [a, b] is a bidirectional link. A connection is 'critical' if removing it disconnects some server from the rest of the network (a bridge). Return all critical connections, each as a pair [a, b]. Order of the returned pairs does not matter, and each pair may be in either order.
Implement
critical_connections(n: int, connections: list[list[int]]) → list[list[int]]Examples
in
[4,[[0,1],[1,2],[2,0],[1,3]]]out[[1,3]]What a strong answer looks like
State 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.
0:00 of about 40 min
solution.py
InputExpectedGot
[4,[[0,1],[1,2],[2,0],[1,3]]][[1,3]]not run yetsample