Min XOR value


Problem Setter: mihai.gheorghe Problem Tester: archit.rai

Given an integer array A of N integers, find the pair of integers in the array which have minimum XOR value. Report the minimum XOR value.

Input Format:

    First and only argument of input contains an integer array A

Output Format:

    return a single integer denoting minimum xor value

Constraints:

2 <= N <= 100 000  
0 <= A[i] <= 1 000 000 000

For Examples :

Example Input 1:
    A = [0, 2, 5, 7]
Example Output 1:
    2
Explanation:
    0 xor 2 = 2
Example Input 2:
    A = [0, 4, 7, 9]
Example Output 2:
    3
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Min XOR value on Interview Code Editor
Sign Up
to access hints and editorial solutions for Min XOR value
Asked In:

Discussion


Loading...
Click here to start solving coding interview questions