Given a rooted tree with N weighted nodes. Find the maximum bitwise xor of two non-overlapping subtree sums in a tree. Subtree sum of a node is the sum of weights of all nodes present in its subtree including the node itself.
This problem is similar to finding maximum xor of two numbers in an array but I am not able to understand how to include non-overlapping condition. Could you help how to approach this problem and if you can provide code it would be very helpful as well.