The problem involves a directed graph that initially was a rooted tree with n nodes, where all nodes have distinct values from 1 to n. An additional directed edge has been added to this tree, which created a cycle. The task is to identify an edge which, when removed, will restore the graph to a rooted tree. If there are multiple possible edges to remove, return the one that appears last in the provided edge list.
Click Run to execute sample tests.