SUBARRAY WITH MAXIMUM XOR

How to implement the second method as explained in the video?

hello @samardeep
its simple

a) prepare a prefix xor array.
 
ie
pref[i]=a[i] ^ pref[i-1]

b) after that look for all subarray
maximum=0
for i in range [0...n-1]
         for j in range[i...n-1] 
               if i==0 
                     maximum=max(pref[j],maximum)
               else
                    maximum=max(pref[j]^pref[i-1],maximum)



print maximum

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.