Practice Minimum Score After Removals on a Tree
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Minimum Score After Removals on a Tree
Problem Statement
nums[i] is the value of node i and edges contains the undirected tree edges [a,b]. Remove exactly two different edges, producing three connected components. Compute the XOR of node values in each component; the score is the largest of those three XOR values minus the smallest. Return the minimum possible score.
Source: Minimum Score After Removals on a Tree on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [1,5,5,4,11], edges = [[0,1],[1,2],[1,3],[3,4]]
9
# Example 2
nums = [5,5,2,4,4,2], edges = [[0,1],[1,2],[5,2],[4,3],[1,3]]
0
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Score After Removals on a Tree.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.