LeetCode 421 Maximum XOR of Two Numbers - Problem Statement

The problem

Find the maximum XOR of any two numbers in the array.

With nums = [3,10,5,25,2,8]:

  • 5 XOR 25 = 00101 XOR 11001 = 11100 = 28.
  • No pair produces a larger XOR.
  • Answer: 2828.

With nums = [14,70,53,83,49,91,36,80,92,51,66,70]:

  • Maximum XOR is 127127.

Constraints: 11 \le nums.length 2×105\le 2 \times 10^5. 00 \le nums[i] 2311\le 2^{31} - 1.