Python Simple Solution (beginners) (video + code) (Trie)
\nhttps://www.youtube.com/watch?v=wSgrc98d2lI\n\nclass TrieNode:\n    def __init__(self):\n        self.children = {}\n        \nclass Solution:\n    def __init
[](https://www.youtube.com/watch?v=wSgrc98d2lI)\nhttps://www.youtube.com/watch?v=wSgrc98d2lI\n```\nclass TrieNode:\n    def __init__(self):\n        self.children = {}\n        \nclass Solution:\n    def __init__(self):\n        self.root = TrieNode()\n    \n    def insert_bits(self, num):\n        bit_num = bin(num)[2:].zfill(32)\n        node = self.root\n        for bit in bit_num:\n            if bit not in node.children:\n                node.children[bit] = TrieNode()\n            node = node.children[bit]\n    \n    \n    def find_max_xor(self, num):\n        bit_num = bin(num)[2:].zfill(32)\n        node = self.root\n        max_xor = \'\'\n        for bit in bit_num:\n            if bit == \'0\':\n                oppo_bit = \'1\'\n            elif bit == \'1\':\n                oppo_bit = \'0\'\n            \n            if oppo_bit in node.children:\n                max_xor += oppo_bit\n                node = node.children[oppo_bit]\n            else:\n                max_xor += bit\n                node = node.children[bit]\n        \n        return int(max_xor, 2) ^ num\n    \n    \n    def findMaximumXOR(self, nums: List[int]) -> int:\n        for num in nums:\n            self.insert_bits(num)\n        \n        max_ = 0\n        for num in nums:\n            max_ = max(max_, self.find_max_xor(num))\n            \n        return max_\n```
['Bit Manipulation', 'Trie', 'Python', 'Python3']