ORIGINAL CODING QUESTION
Critical network edges
Count undirected edges whose individual removal increases the connected-component count. Parallel edges are separate: removing one may leave another route.
Original exercise · hard. Editorial role relevance does not imply a company has asked this question.
Input and output
n m, then m vertex pairs (u,v). Vertices are zero-based.
Constraints
1 ≤ n ≤ 30; 0 ≤ m ≤ 100; vertex IDs in [0,n).
Example 1
Input
3 2 0 1 1 2
Output
2
Both path edges are critical.
Example 2
Input
2 2 0 1 0 1
Output
0
Neither parallel edge is critical alone.
Explain your approach
Explain your time and auxiliary space complexity. Which input makes your algorithm work hardest?
Private grading inputs, expected outputs and canonical reference implementations are withheld. Authored expected outputs were cross-checked with independent reference oracles; compiler/runtime behavior still needs a verified execution provider.
Hint 1
A bridge has no alternate path between its endpoints.
Hint 2
A baseline can remove each edge and recount components.
Hint 3
Low-link traversal must track edge identity, not only parent vertex.
Practice this question
Save your work privately, explain decisions and return to your revision queue.
Open practice workspaceBrowse the question library →