题目描述
Given an array arr[] of size, N. Find the subarray with maximum XOR. A subarray is a contiguous part of the array.
Example 1:
Input:
N = 4
arr[] = {1,2,3,4}
Output: 7
Explanation:
The subarray {3,4} has maximum xor
value equal to 7.
Your Task:
You don't need to read input or print anything. Your task is to complete the function maxSubarrayXOR() which takes the array arr[], its size N as input parameters and returns the maximum xor of any subarray.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
Constraints:
1 <= N <= 10^{5}
1^{ }<= arr[i] <= 10^{5}
输入格式
见题面
输出格式
见题面
样例输入
N = 4
arr[] = {1,2,3,4}
样例输出
7