Maximum XOR of Two Numbers

Medium · Trie · about 25 minutes

Asked at Google, Microsoft, Amazon.

nums contains non-negative integers, each less than 2³¹. Choose two of them (the same element may be chosen twice) so that their bitwise XOR is as big as possible, and return that XOR.

Related guides