Maximum Xor

  • + 0 comments

    The trie for [0,3] would be like

          root
          /   \
        0/     \1
        /       \
       0         3
    
    • By algorithm first we should obtain the 1's complement of 2, which can be obtained as 2^3 = 01
    • Now traverse the trie using 01 we first have to follow 0 for which an actual path exists and hence we arrive at a leaf node. Thus 0 is our answer which is what exactly is expected