I didnt get how the output (10) is got??
Range XOR problem
The question says that there are 2 types of queries. Type 0 and type 1. In 0, you just have to add given element to array. In 1, you are given 3 numbers L, R and X. You have to find a number (N) from the array between the given indices L and R, so that you get the maximum possible value of XOR for X^N.
To maximize XOR, your logic will involve ensuring that the corresponding bits of both these numbers are complementary wherever possible. This is because 0^1 and 1^0 is 1. If the corresponding bits are same, 0^0 and 1^1 is 0, so you will not be able to maximize the XOR value.
L and R are the indexes of the array and you have to find the Y in that region
also X = 6 and L=1 and R=4
So if we take 10
10 ^ 6=12
which is max
And we have to print Y hence in this case it will be 10.
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.