Search
⌘K

Leetcode 685. Redundant Connection II

Given a directed graph formed by adding one extra edge to a rooted tree, identify which single edge (returning the one that appears last in the input when multiple choices exist) to remove so every node has exactly one parent and the graph becomes a rooted tree; the core challenge is handling the two cases where the extra edge creates either a node with two parents or a directed cycle.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.