Hard · Graphs
Critical Connections in a Network
Given n servers numbered 0 to n − 1 and a list of undirected connections that form a connected network, return every critical connection in any order. A connection is critical when removing it leaves some server unable to reach another.
Examples
Example 1
{
"adj": [
[1, 2],
[0, 2],
[1, 0, 3],
[2, 4],
[3]
]
}Output: [[3, 4], [2, 3]]
Example 2
{
"adj": [
[1, 2],
[0, 2, 3],
[0, 1],
[1, 4, 5],
[3, 5],
[3, 4]
]
}Output: [[1, 3]]
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.