Test case 1 is not passing. Check out and resolve it.
Maximum XOR Subarray
You just have to do this in your code.
for (int i = 0; i < n; i++) {
cin >> arr[i];
if (i > 0)
arr[i] = arr[i] xor arr[i - 1];
}
since you have to do xor of the subarray. xor[iā¦j] = xor[0ā¦j] xor [0ā¦i-1]
I have made the changes in your code and it passed all the testcases.
I hope it resolves your doubt. If yes please mark it as resolved.
1 Like