You are given an undirected tree consisting of n nodes numbered from n nums of length n where nums[i] represents the value assigned to the edges of length n edges[i] = [a_i, b_i] denotes an undirected edge connecting nodes a_i and b_i.
Two distinct edges are chosen and removed from the tree, dividing it into three separate connected components.
The XOR value of a component is defined as the bitwise XOR sum of the values of all nodes in that component.
The score of a pair of removed edges is the difference between the largest XOR value and the smallest XOR value among the three resulting components.
Return the minimum possible score that can be obtained by removing two distinct edges.
Constraints:
n nums.length
n
nums[i]
edges.length n
edges[i].length
a_i, b_i n
a_i b_i
edges forms a valid tree.
You are given an undirected tree consisting of n nodes numbered from n nums of length n where nums[i] represents the value assigned to the edges of length n edges[i] = [a_i, b_i] denotes an undirected edge connecting nodes a_i and b_i.
Two distinct edges are chosen and removed from the tree, dividing it into three separate connected components.
The XOR value of a component is defined as the bitwise XOR sum of the values of all nodes in that component.
The score of a pair of removed edges is the difference between the largest XOR value and the smallest XOR value among the three resulting components.
Return the minimum possible score that can be obtained by removing two distinct edges.
Constraints:
n nums.length
n
nums[i]
edges.length n
edges[i].length
a_i, b_i n
a_i b_i
edges forms a valid tree.