[C++/Python] Trie Solution - Clean & Concise - O(32N)
Idea\n- Iterate elements x in nums, add x into our Trie.\n- Iterate elements x in nums again, find the maximum XOR result between a value val and a number in ou
**Idea**\n- Iterate elements `x` in `nums`, add `x` into our Trie.\n- Iterate elements `x` in `nums` again, find the maximum XOR result between a value `val` and a number in our Trie.\n- How to get the maximum XOR result between a value `val` and a number in our Trie in `O(1)`? \n\t- Our Trie will store numbers in form of their 32 bit presentation, store the **most significant bit** near the root.\n\t- Since in `XOR` operator, 2 bit is different will result bit `1`, that is `1^0=1`, `0^1=1`, otherwise will be 0.\n\t- To find the maximum XOR of a value `val` with numbers in our Trie, we traverse 18 bits of `val` with the  **most significant bit** first.\n\t\t- If the current bit of `val` is `1`, we check if exist a number with bit `0` in the Trie, if exist then the bit result is `1`.\n\t\t- If the current bit of `val` is `0`, we check if exist a number with bit `1` in the Trie, if exist then the bit result is `1`.\n\t\t- Else the bit result is `0`.\n\n<iframe src="https://leetcode.com/playground/7hQTAuMo/shared" frameBorder="0" width="100%" height="700"></iframe>\n\n**Complexity**\n- Time: `O(32 * N)`\n- Space: `O(32 * N)`
[]