CT029

Maximum XOR Pair

HardAcceptance: 0.0%

The Codetikki cryptographers encode messages using XOR. They need to find two numbers in an array whose XOR is the maximum possible. Given an array of integers, find the maximum XOR of any two elements.

Example 1:

Input: 3 3 10 5
Output: 15

Example 2:

Input: 5 8 10 2 0 3
Output: 10

Constraints:

1 <= n <= 10^5 0 <= arr[i] <= 2^31 - 1

Tags:

trie bit-manipulation array
Loading...
Test Cases:No test cases
No test cases available.