Maximum XOR of a Pair
Choose two elements (possibly equal indices forbidden, N ≥ 2) maximizing ai ⊕ aj. Print the maximum XOR.
Input: the first line has N; the second line has N non-negative integers.
Output: the maximum pairwise XOR.
Constraints:
- 2 ≤ N ≤ 105
- 0 ≤ ai < 230
Sample Tests
Input 1
3 2 4 5
Output 1
7
Input 2
2 8 8
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.