Subarray with Maximum XOR

I kind of understood the approach, but I am not very sure about the implementation. Can you please explain me the approach again? So that I can put it into a code?

Hey @gptradhika1208 ,
This is the algorithm, Make sure you understand the algorithm properly and then only you code it and make sure you understand the different implementation of trie data structure

  1. Create an empty Trie. Every node of Trie is going to
    contain two children, for 0 and 1 value of bit.
  2. Initialize pre_xor = 0 and insert into the Trie.
  3. Initialize result = minus infinite
  4. Traverse the given array and do following for every
    array element arr[i].
    a) pre_xor = pre_xor ^ arr[i]
    pre_xor now contains xor of elements from
    arr[0] to arr[i].
    b) Query the maximum xor value ending with arr[i]
    from Trie.
    c) Update result if the value obtained in step
    4.b is more than current value of result.

Hope it helps :blush: .
If your doubt is now resolved please mark it as resolved and rate me accordingly .
Else you can further questions here .
Thankyou

Thankyou , it really helped!