There is an undirected tree with nums of length nums[i] represents the value assigned to node edges of length edges[i] =
You may delete any number of edges to split the tree into several connected components. The value of a component is the sum of the values of all nodes inside it.
Return the maximum number of edges you can delete such that every resulting connected component has the exact same value.
Constraints:
nums.length
nums[i]
edges.length
edges[i].length
edges[i][0], edges[i][1]
edges represents a valid tree.
There is an undirected tree with nums of length nums[i] represents the value assigned to node edges of length edges[i] =
You may delete any number of edges to split the tree into several connected components. The value of a component is the sum of the values of all nodes inside it.
Return the maximum number of edges you can delete such that every resulting connected component has the exact same value.
Constraints:
nums.length
nums[i]
edges.length
edges[i].length
edges[i][0], edges[i][1]
edges represents a valid tree.