Tree solution O(n) time complexity;


1). Create an empty trie. Every node of trie contains two children
for 0 and 1 bits.
2). Initialize min_xor = INT_MAX, insert arr[0] into trie
3). Traversal all array element one-by-one starting from second.
a. First find minimum setbet difference value in trie
do xor of current element with minimum setbit diff that value
b. update min_xor value if required
c. insert current array element in trie
4). return min_xor