Fast Python solution. Beats 99%
Intuition\n Describe your first thoughts on how to solve this problem. \nThe idea behind this solution is to use a bitwise operation to find the maximum XOR val
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe idea behind this solution is to use a bitwise operation to find the maximum XOR value of any two numbers in the list.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThe solution starts by initializing the variable ans to 0. Then, it loops through the bits of the numbers (from the most significant bit to the least significant bit) and for each bit, it shifts the value of ans to the left by 1, and then checks if the current bit can be set to 1 by checking if there are any two numbers in the list with different values for that bit. If there are such numbers, the bit is set to 1 and added to the ans variable.\n\nComplexity\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nwhere n is the number of elements in the list. The solution needs to loop through all the elements in the list and check their bits.\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nwhere n is the number of elements in the list. The solution uses a set to store the prefixes of the numbers in the list.\n# Code\n```\nclass Solution:\n    def findMaximumXOR(self, nums: List[int]) -> int:\n        ans = 0\n        for i in range(32)[::-1]:\n            ans <<= 1\n            prefixes = {num >> i for num in nums}\n            ans += any(ans^1 ^ p in prefixes for p in prefixes)\n        return ans\n```
['Python3']