class Solution(object):
    def findMaximumXOR(self, nums):
        answer = 0
        for i in xrange(31,-1, -1):
            answer <<= 1
            prefixes = {num >> i for num in nums}
            answer += any((answer + 1) ^ p in prefixes for p in prefixes)
        return answer
