Geeksforgeeks

Error

Given an array of non-negative integers of size **N**. Find the maximum possible XOR between two numbers present in the array.

**Example 1:**

â€‹Input:Arr = {25, 10, 2, 8, 5, 3}Output:28Explanation:The maximum result is 5 ^ 25 = 28.

**Example 2:**

Input :Arr = {1, 2, 3, 4, 5, 6, 7}Output :7Explanation :The maximum result is 1 ^ 6 = 7.

You don't need to read input or print anything. Your task is to complete the function **max_xor()** which takes an array of integers and it's size as input and returns maximum XOR of two numbers in an array.

1 <= N <=2*10^{4}

1<= A[i] <= 10^{6}

We are replacing the old Disqus forum with the new Discussions section given below.

Click here to view old Disqus comments.

Click here to view old Disqus comments.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Maximum XOR of two numbers in an array

...