← All problems
Redundant Connection
A tree plus one extra edge; return the edge that can be removed to restore the tree.
Complexity
Time O(n α(n)), Space O(n)
Common pitfalls
- Returning the first cycle edge instead of the last
- DFS cycle detection is O(n^2)
Your solution
Log in to save your code and track progress.