Leetcode 2479. Maximum XOR of Two Non-Overlapping Subtrees
Given a tree with integer node values, compute the XOR-sum of nodes for every node's subtree and find two node-disjoint subtrees whose subtree-XOR values produce the maximum bitwise XOR. The challenge is to efficiently generate and compare subtree XORs under the non-overlap constraint (avoiding O(n^2) pair checks), typically requiring tree traversal combined with bitwise-tries or merge-on-tree techniques.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.