JAVA || Trie || Binary Tree || Bit manipulation
\nclass Solution {\n    class TrieNode {\n        TrieNode left, right;\n        public TrieNode() {\n            left = null;\n            right = null;\n     
```\nclass Solution {\n    class TrieNode {\n        TrieNode left, right;\n        public TrieNode() {\n            left = null;\n            right = null;\n        }\n    }\n    \n    //Insert by iteration\n    public void insert(TrieNode root, int num) {\n        TrieNode curr = root;\n        \n        for(int i = 31; i >= 0; i--) {\n            int bit = (num>>i) & 1;\n            if(bit == 0) {\n                if(curr.left == null) {\n                    curr.left = new TrieNode();\n                }\n                curr = curr.left;\n            } else {\n                if(curr.right == null) {\n                    curr.right = new TrieNode(); \n                }\n                curr = curr.right;\n            }\n        }\n    }\n    \n    public int getMaxXor(TrieNode root, int num) {\n        TrieNode curr = root;\n        int maxXor = 0;\n        \n        for(int i = 31; i >= 0; i--) {\n            int bit = (num>>i) & 1;\n            if(bit == 0) {\n                if(curr.right != null) {\n                    curr =  curr.right;\n                    maxXor += (1<<i);\n                } else {\n                    curr = curr.left;\n                }\n            } else {\n                if(curr.left != null) {\n                    curr = curr.left;\n                    maxXor += (1<<i);   //pow(2,i)\n                } else {\n                    curr = curr.right;\n                }\n            }\n        }\n        \n        return maxXor;\n    }\n    \n    public int findMaximumXOR(int[] nums) {\n        TrieNode root = new TrieNode();\n        int maxXor = Integer.MIN_VALUE;\n        \n        for(int num: nums) {\n            insert(root, num);\n        }\n        \n        for(int num: nums) {\n            maxXor = Math.max(maxXor, getMaxXor(root, num));\n        }\n        \n        return maxXor;\n    }\n}\n```
['Bit Manipulation', 'Trie', 'Binary Tree', 'Java']