323. Maximum XOR of Two Numbers
HardTrieBits
Print the maximum value of a[i] XOR a[j] over all pairs (i may equal j, giving 0).
Input format
Line 1: n Line 2: n integers
Output format
The maximum XOR.
Example 1
Input
6 3 10 5 25 2 8
Output
28
Example 2
Input
1 0
Output
0
Constraints
1 ≤ n ≤ 10⁵ 0 ≤ values < 2³¹
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…