242. Maximum XOR of Two Numbers in an Array

MediumBit Manipulation

Given an integer array nums, return the maximum result of nums[i] XOR nums[j], where 0 <= i <= j < n.

Examples

Input: [3,10,5,25,2,8]

Output: 28

Explanation: 5 XOR 25 = 28 is the maximum pairwise XOR.

Constraints

  • 1 <= nums.length <= 2 * 10^5
  • 0 <= nums[i] <= 2^31 - 1
Loading...

Run checks all cases above. Submit evaluates all test cases.