Leetcode 1938. Maximum Genetic Difference Query
Given a rooted tree where each node's value equals its index, answer queries asking for the maximum XOR between a given value and any node value on the path from a specified node to the root; efficiently solved by doing a DFS and maintaining a dynamic binary trie (insert/remove node indices as you traverse) to support fast max-XOR lookups.
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.