Clean Java Solution using Trie
\nclass Solution {\n    TreeNode root;\n    class TreeNode {\n        int val;\n        public TreeNode[] children;\n        public TreeNode(){\n            chi
```\nclass Solution {\n    TreeNode root;\n    class TreeNode {\n        int val;\n        public TreeNode[] children;\n        public TreeNode(){\n            children = new TreeNode[2];\n        }\n    }\n    public void insert(int word) {\n        TreeNode cur = root;\n        for(int i=31;i>=0;i--) {\n            int j = ((word >>>i)&1) == 0?0:1;\n            TreeNode child = cur.children[j];\n            child = child == null?new TreeNode():child;\n            cur.children[j] = child;\n            cur = child;\n        }\n        cur.val = word;\n    }\n    public int getLarget(int prefix) {\n        TreeNode cur = root;\n        for(int i=31;i>=0;i--) {\n            int j = ((prefix >>>i)&1 ) == 0?1:0;\n            if(cur.children[j] == null) j = 1-j;\n            TreeNode child = cur.children[j];\n            cur = child;\n        }\n        return cur.val;\n    }\n    \n    public int findMaximumXOR(int[] nums) {\n        root = new TreeNode();\n        for(int x:nums) insert(x);\n        int max = 0;\n        for(int x:nums) {\n            max = Math.max(max,x^getLarget(x));\n        }\n        return max;\n    }\n}\n```
[]