Java O(n) solution using bit manipulation and HashMap
\npublic class Solution {\n    public int findMaximumXOR(int[] nums) {\n        int max = 0, mask = 0;\n        for(int i = 31; i >= 0; i--){\n            mask 
```\npublic class Solution {\n    public int findMaximumXOR(int[] nums) {\n        int max = 0, mask = 0;\n        for(int i = 31; i >= 0; i--){\n            mask = mask | (1 << i);\n            Set<Integer> set = new HashSet<>();\n            for(int num : nums){\n                set.add(num & mask);\n            }\n            int tmp = max | (1 << i);\n            for(int prefix : set){\n                if(set.contains(tmp ^ prefix)) {\n                    max = tmp;\n                    break;\n                }\n            }\n        }\n        return max;\n    }\n}\n```
[]