comefrom: <doocs>0085.Maximal Rectangle_1.py
code: def largestRectangleArea( heights: List[int]) -> int:
      n = len(heights)
      stk = []
      left = [-1] * n
      right = [n] * n
      for i, h in enumerate(heights):
          while stk and heights[stk[-1]] >= h:
              stk.pop()
          if stk:
              left[i] = stk[-1]
          stk.append(i)
      stk = []
      for i in range(n - 1, -1, -1):
          h = heights[i]
          while stk and heights[stk[-1]] >= h:
              stk.pop()
          if stk:
              right[i] = stk[-1]
          stk.append(i)
      return max(h * (right[i] - left[i] - 1) for i, h in enumerate(heights))
masked: def sample_funcname ( var_0 : List [ int ] ) -> int :
      var_4 = len ( var_0 )
      var_5 = [ ]
      var_7 = [ - 1 ] * var_4
      var_8 = [ var_4 ] * var_4
      for var_10 , var_11 in enumerate ( var_0 ) :
          while var_5 and var_0 [ var_5 [ - 1 ] ] >= var_11 :
              var_5.pop ( )
          if var_5 :
              var_7 [ var_10 ] = var_5 [ - 1 ]
          var_5.append ( var_10 )
      var_5 = [ ]
      for var_10 in range ( var_4 - 1 , - 1 , - 1 ) :
          var_11 = var_0 [ var_10 ]
          while var_5 and var_0 [ var_5 [ - 1 ] ] >= var_11 :
              var_5.pop ( )
          if var_5 :
              var_8 [ var_10 ] = var_5 [ - 1 ]
          var_5.append ( var_10 )
      return max ( var_11 * ( var_8 [ var_10 ] - var_7 [ var_10 ] - 1 ) for var_10 , var_11 in enumerate ( var_0 ) )
  