Close
Topic list
Critical Connections in a Network
HARD
Graph
Topics (Covered in this problem)
Problem solved
Skill meter
Graph
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Critical Connections in a Network

Contributed by
Yash Chaudhari
Hard
0/120
Share

## Problem Statement

#### Return all critical connections in the network in any order. If there are no critical connections return empty matrix.

##### For Example:
``````For the given graph
``````

``````If we remove the connection between ‘2’ and ‘4’. Then ‘4’ will not be reachable from any other server.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1 :
``````2
4 4
1 2
1 3
2 3
2 4
3 2
1 2
2 3
``````
##### Sample Output 1 :
``````2 4
1 2
2 3
``````
##### Explanation of Sample Output 1 :
``````In test case 1, the graph is shown below.
``````

``````If we remove the connection between ‘2’ and ‘4’. Then ‘4’ will not be reachable from any other server.

In test case 2, the graph is shown below.
``````

``````If we remove the connection between ‘3’ and ‘2’. Then ‘3’ will not be reachable from any other server. Similarly, if we remove the connection between ‘1’ and ‘2’. Then ‘1’ will not be reachable from any other server.
``````
##### Sample Input 2 :
``````2
2 1
1 2
4 4
1 2
1 3
3 4
2 4
``````
##### Sample Output 2 :
``````1 2
``````
##### Explanation of Sample Output 2 :
``````In test case 1, the graph is shown below.
``````

``````If we remove the connection between ‘1’ and ‘2’. Then ‘1’ will not be reachable from any other server.

In test case 2, the graph is shown below.
``````

``````No matter which connection we remove it is not possible to make some servers unable to reach some other server.
``````
Auto
Console