Company: Experian_1july
Difficulty: medium
Turn Off The Tree Problem Description You will be given a tree of N nodes and M edges. Each node in the tree has a value assigned to it such that the value for the i th node is state[i] . It is given that the state of each node is either 0 or 1. When you click on some node, then the states of this node and all nodes connected directly to it will be reversed. In other words, each 0 will become 1, and each 1 will become 0. Your task is to find the minimum number of needed clicks to make the state value for all nodes in the tree equal to 0. If the goal of making all values equal to 0 can never be achieved, print -1. Note: It is guaranteed that M is always equal to N-1. Complete the getMin function in the editor below. It has the following parameter(s): N : INTEGER - The number of nodes in the tree. M : INTEGER - The number of edges in the tree. col : INTEGER - Number of columns in matrix A. The value of col is always 2. A : INTEGER 2D ARRAY - The array describing the edges of the tree, th