what should be the approch for this question i amm confused …please tell me
Maximum Xor subarray
You can follow the simplest approach of doing this:
Just take implement loops and find XOR of all subarrays and return the maximum.
Step:
-
Iterate Outter loop from i = 0 to n-1.
-
Iterate inner loop from i to n-1.
2.1. Calculate XOR of subarrays.
2.2. If the “current XOR” is greater than the “max XOR”, make it the “max XOR”. -
Print the “max XOR”
Note: XOR of two numbers is calculated as:
Xor = num1 ^ num2
Hope this would help.
If you still have doubts, feel free to ask.
If you are satisfied, give a like.