python solution with detail comments
\t# [3,  10,   5,   25,    2,   8]\n    # [11, 110,  101, 11001, 10,  1000]\n    \n    def findMaximumXOR(self, nums: List[int]) -> int:\n        ans = 0\n     
\t# [3,  10,   5,   25,    2,   8]\n    # [11, 110,  101, 11001, 10,  1000]\n    \n    def findMaximumXOR(self, nums: List[int]) -> int:\n        ans = 0\n        for i in range(31,-1,-1):\n            prefixs = set([num>>i for num in nums])\n            #to get the first i digits of the num. In the given example [3, 10, 5, 25, 2, 8], \n            #since the largest number 25 is 11001 in binary, thus while i>=5, the prefix = {0}, ignoring all preceding \'0\'\n            #prefix ={0,1} when i ==4, \n            #prefix ={00,01,11} when i ==3, etc.\n            \n            ans <<=1 # 0 -> 00  1 ->10\n            candidate = ans+1 # 0->01 1->11\n            #so ans and candidate basically gives two options (0 or 1) on every new digit added\n            #and candidate is the largest possible number given the length of the digit. It\'s sort of a greedy algorithm here.\n            #if previous ans == 1, then the new ans and candidate will be 10 and 11\n            #depands on if we could get 1 on the new digit, we choose if we move forward with ans(10) or candidate(11)\n            \n            for pre in prefixs:\n                if candidate ^ pre in prefixs:\n                    ans = candidate\n                    break\n            # the if condition pre^candidate in prefix is based on the fact a^b^a = b\n            # assume a, b in prefix could generate the largest possilbe xor resuglt "candidate". then if we use candidate^a, the result will be b\n            # so if we do find pre^candidate in prefix, candidate will move forward(ans = candidate), meaning we get 1 in the new digit\n            \n        return ans
['Bit Manipulation', 'Python']