':type nums: List[int]
:rtype: int'

def findMaximumXOR(self, nums):

    result = 0
    for i in reversed(xrange(32)):
        result <<= 1
        prefixes = set()
        for n in nums:
            prefixes.add((n >> i))
        for p in prefixes:
            if (((result | 1) ^ p) in prefixes):
                result += 1
                break
    return result
