comefrom: <qiyuangong>236_Lowest_Common_Ancestor_of_a_Binary_Tree_1.py
code: def lowestCommonAncestor( root, p, q):
      stack = [root]
      parent = {root: None}
      while p not in parent or q not in parent:
      
          node = stack.pop()
      
          if node.left:
              parent[node.left] = node
              stack.append(node.left)
          if node.right:
              parent[node.right] = node
              stack.append(node.right)
      
      ancestors = set()
      
      while p:
          ancestors.add(p)
          p = parent[p]
      
      while q not in ancestors:
          q = parent[q]
      return q
masked: def sample_funcname ( var_0 , var_1 , var_2 ) :
      var_3 = [ var_0 ]
      var_5 = { var_0 : None }
      while var_1 not in var_5 or var_2 not in var_5 :
          var_7 = var_3.pop ( )
          if var_7.left :
              var_5 [ var_7.left ] = var_7
              var_3.append ( var_7.left )
          if var_7.right :
              var_5 [ var_7.right ] = var_7
              var_3.append ( var_7.right )
      var_12 = set ( )
      while var_1 :
          var_12.add ( var_1 )
          var_1 = var_5 [ var_1 ]
      while var_2 not in var_12 :
          var_2 = var_5 [ var_2 ]
      return var_2
  