Z37
Critical Connections in a Network (Bridges)
Problem Statement & Objective
There are n servers numbered from 0 to n - 1 connected by undirected server-to-server connections. Return all critical connections (Tarjan's bridge finding algorithm).
Function Signature (Python)
critical_connections(n: int, connections: list[list[int]]) -> list[list[int]]Input & Output Contract
Output Rule:Kritik bağlantılar listesi (sıralı).
System Constraints
2 <= n <= 10^5
n - 1 <= baglantilar.length <= 10^5
0 <= u, v < n, u != v
Ağ başlangıçta tamamen bağlıdırExample Execution Walkthrough
n = 4, baglantilar = [[0, 1], [1, 2], [2, 0], [1, 3]]
[1, 3] koparsa 3 izole olur -> cevap: [[1, 3]]Example Test Scenarios (3)
Example 1
Input:
[4,[[0,1],[1,2],[2,0],[1,3]]]Expected Output:
[[1,3]]Example 2: Tek Hat
Input:
[2,[[0,1]]]Expected Output:
[[0,1]]Example 3: Halka (Köprü Yok)
Input:
[3,[[0,1],[1,2],[2,0]]]Expected Output:
[]