I can’t figure out how to approach this problem , please give some hints.
Please tell me how to approach
@jayasmit98
Firstly you insert every number into the trie where every node is a bit, i.e, either 1 or 0. Also each node contains a vector which stores the indexes of the elements for which that particular bit is set. Thus when you make a query for range [l, r] and are given an integer x, you traverse the trie for the opposite bits which are present in x, because opposite bits at every position will maximize the xor value. Do the question max xor pair and you will be able to understand the concept behind this question.
If you face any difficulty, please feel free to revert back.