Code Room
CodingHardcod-g920
Subject GraphsLevel Senior–Staff~40 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

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.

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.

Run or narrate your approach, then ask the coach.