Critical Connections
Hard Accuracy: 27.87% Submissions: 1197 Points: 8

Given an undirected Connected graph of V vertices and E edges.
A critical connection is an edge that, if removed, will make some nodes unable to reach some other nodes. Find all critical connections in the graph.
Note: There are many possible orders for the answer. You are supposed to print the edges in sorted order, and also an edge should be in sorted order too. So if there's an edge between node 1 and 2, you should print it like (1,2) and not (2,1).

Example 1:


0 1
0 2
Both the edges in the graph are Crtical

Example 2:


2 3
The edge between nodes 2 and 3 is the only
Critical connection in the given graph.

Your task:
You don’t need to read input or print anything. Your task is to complete the function criticalConnections() which takes the integer V denoting the number of vertices and an adjacency list adj as input parameters and returns
 a list of lists containing the Critical connections in the sorted order.

Expected Time Complexity: O(V + E)
Expected Auxiliary Space: O(V)

1 ≤ V, E ≤ 104

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.

to report an issue on this page.


We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?


All Submissions

My Submissions:

Login to access your submissions.

Critical Connections

Output Window