comefrom: <garvit244>85_1.py
code: def largestRectangleArea( heights):
      if not heights:
          return 0
      
      stack = []
      result, index = 0, 0
      
      while index < len(heights):
          if not stack or heights[index] >= heights[stack[-1]]:
              stack.append(index)
              index += 1
          else:
              curr = stack.pop()
              if not stack:
                  area = heights[curr]*index
              else:
                  area = heights[curr] * (index-stack[-1]-1)
              result = max(result, area)
      
      while stack:
          curr = stack.pop()
          if not stack:
              area = heights[curr]*index
          else:
              area = heights[curr] * (index-stack[-1]-1)
          result = max(result, area)
      return result
masked: def sample_funcname ( var_0 ) :
      if not var_0 :
          return 0
      var_2 = [ ]
      var_3 , var_4 = 0 , 0
      while var_4 < len ( var_0 ) :
          if not var_2 or var_0 [ var_4 ] >= var_0 [ var_2 [ - 1 ] ] :
              var_2.append ( var_4 )
              var_4 += 1
          else :
              var_9 = var_2.pop ( )
              if not var_2 :
                  var_10 = var_0 [ var_9 ] * var_4
              else :
                  var_10 = var_0 [ var_9 ] * ( var_4 - var_2 [ - 1 ] - 1 )
              var_3 = max ( var_3 , var_10 )
      while var_2 :
          var_9 = var_2.pop ( )
          if not var_2 :
              var_10 = var_0 [ var_9 ] * var_4
          else :
              var_10 = var_0 [ var_9 ] * ( var_4 - var_2 [ - 1 ] - 1 )
          var_3 = max ( var_3 , var_10 )
      return var_3
  