Redundant Connection 2
You are given a directed graph that started as a tree with n nodes labeled from 1 to n, with one additional edge added. The added edge has two different vertices chosen from 1 to n, and was not an edge that already existed. The graph is represented as an array edges of length n where edges[i] = [xi, yi] indicates that there is a directed edge between nodes xi and yi in the graph.Input Format
Return an edge that can be removed so that the resulting graph is a tree of n nodes. If there are multiple answers, return the answer that occurs last in the input.
Note : The difference between redundant connection and redundant connection 2 is that in later the graph is directed and in the former graph is undirected.
First line contains an integer n.Output Format
Each of next n lines contain 2 numbers denoting a bidirectional edge between them.
Print the edge that can be removed so that the resulting graph is a tree of n nodes. If there are multiple answers, return the answer that occurs last in the input.Question Video
1<= n <= 10000Sample Input
number of edge = number of vertices
Asked in Companies