2. Maximum XOR value of subarray #
Created Monday 27 July 2020
Given an array, find the maximum XOR value possible among the elements of some subarray.
- Naively, this is O(n^2^) problem.
- If we use some memory, we can do better. We’re going to use a tree data structure because it helps us to avoid non-maximum paths.
- We calculate the XOR’s of ending at and beginning from. These are 2*n XORs. All other XOR’s are a combination of these.
- We insert both the sets in the array as bits.
- Next we traverse through these are find the maximum possible.
- We return the value.