题目描述
Given an array arr[ ] of positive integers, the task is to find the maximum XOR value of the elements from all the possible subsets.
Example 1:
Input: N = 3, arr[] = {2, 4, 5}
Output: 7
Explanation: Subset {2, 5} has maximum xor
Example 2:
Input: N = 1, arr[] = {1}
Output: 1
Explanation: Subset {1} has maximum xor
Your Task:
You don't need to read input or print anything. Complete the function maxXor() which takes N and array arr as input parameter and returns the maximum xor value.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N, arr[i] ≤ 10^{5}
输入格式
见题面
输出格式
见题面
样例输入
N = 3, arr[] = {2, 4, 5}
样例输出
7