Loading...
You are given an integer array nums.
nums
Return the largest value of nums[i] XOR nums[j] over all index pairs with 0 <= i <= j < nums.length.
nums[i] XOR nums[j]
0 <= i <= j < nums.length
Because i and j may be equal, an array of length 1 has an answer of 0, since a value XORed with itself is 0.
i
j
0
Input: nums = [3,10,5,25,2,8] Output: 28 Explanation: The best pair is 5 XOR 25 = 28. No other pair reaches it.
Input: nums = [14,70,53,83,49,91,36,80,92,51,66,70] Output: 127 Explanation: Some pair XORs to 127, which sets all seven low bits.
nums.length
nums[i]
Click "Run" to test with sample cases or "Submit" to run all tests.