title: What is the time complexity for this proposed solution
body: <p><strong>Question</strong></p>
  <p><em>Given an integer array nums, return the maximum result of nums[i] XOR nums[j], where 0 &lt;= i &lt;= j &lt; n.</em></p>
  <p><strong>Example 1:</strong></p>
  <p><em>Input:</em> nums = [3,10,5,25,2,8] <br/>
  <em>Output</em>: 28 <br/>
  <em>Explanation:</em> The maximum result is 5 XOR 25 = 28.<br/></p>
  <p><strong>Constraints:</strong> <br />
  1 &lt;= nums.length &lt;= 2 * 105 <br />
  0 &lt;= nums[i] &lt;= 231 - 1</p>
  <p><strong>Approach:</strong>
  I have solved using <code>Trie</code>where I add each elements and after adding I search for the number which can result in maximum <code>xor</code>.</p>
  <p><strong>Solution:</strong></p>
  <pre><code>class TreeNode:
      def __init__(self, value = '-1'):
          self.val = value
          self.left = None
          self.right = None
  class Solution(object):
      def findMaximumXOR(self, a):
          root = TreeNode()
          msf = float('-inf')
          for i in a:
              bits = format(i, 'b').zfill(31)
              node = root
              for bit in bits:
                  if bit == '0' and node.left:
                      node = node.left
                  elif bit == '0':
                      new_node = TreeNode('0')
                      node.left = new_node
                      node = new_node
                  
                  if bit == '1' and node.right:
                      node = node.right
                  elif bit == '1':
                      new_node = TreeNode('1')
                      node.right = new_node
                      node = new_node
              
              ssf=''
              node = root
              for bit in bits:
                  if bit == '0' and node.right:
                      ssf += '1'
                      node = node.right
                  elif bit == '1' and node.left:
                      ssf += '1'
                      node = node.left
                  elif node.left:
                      ssf += '0'
                      node = node.left
                  else:
                      ssf += '0'
                      node = node.right
  
              val = int(ssf, 2)
              msf = max(msf, val)
          return msf
  </code></pre>
  <p><strong>Question</strong>: What is the time complexity of the above solution? In my opinion it is <code>O(N)</code> where <code>N</code> is the number of element in <code>nums</code>.</p>