Maximum XOR of Two Non-Overlapping Subtrees
Compute subtree sums bottom-up, then keep the largest XOR over pairs of nodes that are not ancestor-related.
Compute subtree sums bottom-up, then keep the largest XOR over pairs of nodes that are not ancestor-related.