i didnt get the question
PLease help me to understand it
hello @chemant077,
In this problem u are given an array and u need to tell maximum value of sum of xor of two subarrays.
how to approach this??
have u done maximum xor subarray problem?
i have done max sum subarray but dont understanf how to do the same for 2 aray
am thinking like firstly i found a max subarray by making a xor1 subarray xoring from left to right and trhen to take xor2 subarray by xoring right to left and found their respective max subarray and found the sum
but i guess there is no difference in xoring left to right and right to left
yeah ,this is the right approach.
maintain two arrays. say left ,right.
left[i]=will store max xor subarray possible in index range 0 to i.
right[i]=will store max xor possible in range in index range i to n-1.
now iteratate from 0 to n-1.
take max value of left[i]+right[i+1]
i built this for the given test case but its showing wrong answer
also i didnt get one thing like while getting maximum xor subarray after calling from left and calling maximum xor subarray from right should not give us the same subarray as the max xor function will give us the max subarray of all of it. If solving this problem goes this way then i think i have to found 1st max subarray and then 2nd max subarray posible
ur implementation is not correct.
pls refer editorial once for implementation details