Range Xor problem

What is thinking process behind this code?

Hey @RULEREMPIRES
using trie data structure.
if you dont Know trie . leave it for Now

i know trie but how to think such logic

@RULEREMPIRES
I am telling the truth, these things will come after much practice.