comefrom: <garvit244>199_1.py
code: def rightSideView( root):
      if not root:
          return []
      
      stack, node_depth = [(root, 0)], {}
      
      while stack:
          node, depth = stack.pop(0)
          if depth not in node_depth:
              node_depth[depth] = node.val
      
          if node.right:
              stack.append((node.right, depth+1))
          if node.left:
              stack.append((node.left, depth+1))
      return node_depth.values()
masked: def sample_funcname ( var_0 ) :
      if not var_0 :
          return [ ]
      var_1 , var_2 = [ ( var_0 , 0 ) ] , { }
      while var_1 :
          var_3 , var_4 = var_1.pop ( 0 )
          if var_4 not in var_2 :
              var_2 [ var_4 ] = var_3.val
          if var_3.right :
              var_1.append ( ( var_3.right , var_4 + 1 ) )
          if var_3.left :
              var_1.append ( ( var_3.left , var_4 + 1 ) )
      return var_2.values ( )
  