<qiyuangong>084_Largest_Rectangle_in_Histogram_1.py
def largestRectangleArea( heights):
    largest_rectangle = 0
    ls = len(heights)
    stack = [-1]
    top, pos = 0, 0
    for pos in range(ls):
        while top > 0 and heights[stack[top]] > heights[pos]:
            largest_rectangle = max(largest_rectangle, heights[stack[top]] * (pos - stack[top - 1] - 1))
            top -= 1
            stack.pop()
        stack.append(pos)
        top += 1
    while top > 0:
        largest_rectangle = max(largest_rectangle, heights[stack[top]] * (ls - stack[top - 1] - 1))
        top -= 1
    return largest_rectangle
def sample_funcname ( var_0 ) :
    var_2 = 0
    var_4 = len ( var_0 )
    var_6 = [ - 1 ]
    var_7 , var_8 = 0 , 0
    for var_8 in range ( var_4 ) :
        while var_7 > 0 and var_0 [ var_6 [ var_7 ] ] > var_0 [ var_8 ] :
            var_2 = max ( var_2 , var_0 [ var_6 [ var_7 ] ] * ( var_8 - var_6 [ var_7 - 1 ] - 1 ) )
            var_7 -= 1
            var_6.pop ( )
        var_6.append ( var_8 )
        var_7 += 1
    while var_7 > 0 :
        var_2 = max ( var_2 , var_0 [ var_6 [ var_7 ] ] * ( var_4 - var_6 [ var_7 - 1 ] - 1 ) )
        var_7 -= 1
    return var_2
