Max subarray xor

in the ques subarray with max xor pair what if the a xor of whole array gives max value this case is not computed by the hint given in video

i think we should find the max value of newly updated array and compare it with the value we got after finding max xorpair

Hello @Namanjain123,

The solution for this is the same as you have done in the case of maximum sub-array sum using cumulative sum array.

for array an array a=[a1,a2,a3]
create the xor array as: xor_a=[0, 0^a1, 0^a1^a2, 0^a1^a2^a3]

This way you can consider the whole array also.
Hope, this would help.
Give a like if you are satisfied.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.