Critical Connections
Application of Tarjan's Algorithm to find Bridges in Undirected Graphs
-
Algorithms and Data Structures: TheAlgorist.com
-
System Design: SystemsDesign.Cloud
-
Low Level Design: LowLevelDesign.io
Problem Statment: There are n servers numbered from 0 to n-1 connected by undirected server-to-server connections forming a network where connections[i] = [a, b] represents a connection between servers a and b. Any server can reach any other server directly or indirectly through the network.
A critical connection is a connection that, if removed, will make some server unable to reach some other server.
Return all critical connections in the network in any order.
Example:
2 /| / | / | 1 | | \ | | \| | 0 | 3
Input: n = 4, connections = [[0,1],[1,2],[2,0],[1,3]]
Output: [[1,3]]
Explanation: [[3,1]] is also accepted.
Tag(s): #amazon_interview
Solution:
Algorithm:
This is a Premium content.
Please subscribe to the Algorithms course to access the detailed Algorithm discussion.
Java code:
This is a Premium content.
Please subscribe to Algorithms course to access the code.
Python code:
This is a Premium content.
Please subscribe to Algorithms course to access the code.
Don't forget to take a look at other interesting Graph Problems:
- How to Send Message to Entire Social Network
- Disconnected Network
- Minimal Vertices
- Course Scheduling
Instructor:

Abhishek Dey
A Visionary Software Engineer With A Mission To Empower Every Person & Every Organization On The Planet To Achieve More
Microsoft | University of Florida
If you have any feedback, please use this form: https://thealgorists.com/Feedback.
Follow Us On LinkedIn