Critical Connections

Hard
Graphs Tarjan Bridge Finding
Find all critical connections in a network. Input line 1: n nodes Input lines: edges as u,v Output: critical edges

Constraints

See problem-specific constraints. Optimized solution required.

Examples

Example 1:
Input: 4 0,1 1,2 2,0 1,3
Output:
Example 2:
Input: 4 0,1 1,2 2,0 1,3
Output:

Hints

Consider a tarjan approach.
Think about time complexity.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.