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_2 , var_3 = [ ( var_0 , 0 ) ] , { }
      while var_2 :
          var_5 , var_6 = var_2.pop ( 0 )
          if var_6 not in var_3 :
              var_3 [ var_6 ] = var_5.val
          if var_5.right :
              var_2.append ( ( var_5.right , var_6 + 1 ) )
          if var_5.left :
              var_2.append ( ( var_5.left , var_6 + 1 ) )
      return var_3.values ( )
  