EASY SOLUTION | | TRIE
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nstruct Node{\n    Node* links[2];\n    public:\n    bool containsKey(int bit)\n    {\n        return links[bit]!=NULL;\n    }\n    void put(int bit,Node* node)\n    {\n        links[bit]=node;\n    }\n    Node* get(int bit)\n    {\n        return links[bit];\n    }\n};\nclass Trie{\n    Node* root;\n    public:\n    Trie()\n    {\n        root=new Node();\n    }\n    void insert(int num)\n    {\n        Node* node=root;\n        for(int i=31;i>=0;i--)\n        {\n            int bit=(num>>i)&1;\n            if(!node->containsKey(bit))\n            {\n                node->put(bit,new Node());\n            }\n            node=node->get(bit);\n\n        }\n    }\n    int getMax(int num)\n    {\n        Node* node=root;\n        int maxNum=0;\n        for(int i=31;i>=0;i--)\n        {\n            int bit=(num>>i)&1;\n            if(node->containsKey(1-bit))\n            {\n                maxNum=maxNum|(1<<i);\n                node=node->get(1-bit);\n            }\n            else{\n                node=node->get(bit);\n            }\n        }\n        return maxNum;\n    }\n};\nclass Solution {\npublic:\n    int findMaximumXOR(vector<int>& nums) \n    {\n        Trie trie;\n        for(auto it:nums)\n        {\n            trie.insert(it);\n        }\n    \n        int maxi=0;\n        for(auto it:nums)\n        {\n            maxi=max(maxi,trie.getMax(it));\n        }\n        return maxi;\n    }\n};\n```
['C++']