Company: Oracle_10dec
Difficulty: medium
Minimum Reversal Problem Description You are given a directed graph with g_nodes nodes numbered from 1 to g_nodes and exactly g_nodes - 1 edges. The i-th edge is directed from g_from[i] to g_to[i] . It is guaranteed that the underlying undirected graph is a tree. Select any node as the root and then reverse as many directed edges as necessary so that every node is reachable from the root along directed edges - that is, after the reversals every edge points away from the root. Find the choice of root that needs the fewest reversals and return that number of reversals. Function Description Complete the function getMinInversions() . It has the following parameters and returns the answer: g_nodes : an integer, the number of nodes in the graph. g_from : an integer array, the starting node of each directed edge. g_to : an integer array, the ending node of each directed edge. Returns an integer: the minimum number of edges that must be reversed, taken over all possible roots. Input Format For