
									 Problem
								
								
									 Solution
								
								
									 Submissions
								
								
							Critical Connections in a Network
								Certification: Advanced Level
								Accuracy: 0%
								Submissions: 0
								Points: 15
							
							Write a C++ program to find all critical connections in a network. A critical connection is an edge that, if removed, will make some nodes unable to reach each other. Given a network with n nodes labeled from 0 to n-1 and a list of connections (edges) where each connection is represented by a pair [u, v] indicating that there is an undirected edge between nodes u and v, return all critical connections in the network in any order.
Example 1
- Input: n = 4, connections = [[0,1],[1,2],[2,0],[1,3]]
- Output: [[1,3]]
- Explanation: - The edge [1,3] is the only critical connection in the network.
- If this edge is removed, node 3 will be disconnected from the rest of the network.
 
Example 2
- Input: n = 5, connections = [[0,1],[1,2],[2,0],[1,3],[3,4]]
- Output: [[1,3],[3,4]]
- Explanation: - The edges [1,3] and [3,4] are critical connections.
- If either is removed, the network will have disconnected components.
 
Constraints
- 1 ≤ n ≤ 10^5
- 1 ≤ connections.length ≤ 10^5
- connections[i][0] != connections[i][1]
- No repeated connections
- Time Complexity: O(V + E) where V is number of vertices and E is number of edges
- Space Complexity: O(V + E)
Editorial
									
												
My Submissions
										All Solutions
									| Lang | Status | Date | Code | 
|---|---|---|---|
| You do not have any submissions for this problem. | |||
| User | Lang | Status | Date | Code | 
|---|---|---|---|---|
| No submissions found. | ||||
Solution Hints
- Use Tarjan's algorithm to find bridges in the graph
- Implement a DFS traversal to discover and classify edges
- Keep track of discovery times and lowest reachable vertex
- An edge is a bridge (critical connection) if the lowest reachable vertex from v is greater than the discovery time of u
- Return all identified bridges as the answer
