Maximum XOR of Two Numbers (Trie)
hardUse bitwise trie to maximize xor value
Maximum XOR of Two Numbers
Key Insight
At each bit level, prefer the opposite bit in trie to maximize XOR contribution.
Step 1Start with First Value
3
3
=0
0
0
0
0
0
1
1
76543210
Build trie from 3 (00000011).
1 / 4