Given an integer array nums, return the maximum XOR value of any pair of numbers. Pattern focus: Check kth Bit. Build the best XOR greedily from the most significant bit down to the least significant bit.
nums = array of integers
maximum XOR value among all pairs
Example 1:
Input:
nums = [3,10,5,25,2,8]
Output:
28
Explanation:
25 XOR 5 = 28 is the best pair.
Example 2:
Input:
nums = [0,2]
Output:
2
Explanation:
0 XOR 2 = 2.