Maximum XOR subarray
Medium Accuracy: 44.48% Submissions: 3135 Points: 4

Given an array of integers of size N find subarray with maximum xor. A subbarray is a contiguous part of array.

Example 1:

N = 4
arr[] = {1,2,3,4}
Output: 7
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)


1 <= N <= 105

1 <= arr[i] <= 105

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?


All Submissions

My Submissions:

Login to access your submissions.

Maximum XOR subarray

Output Window