If this bar is lower than top of stack , then calculate area of rectangle with stack top as the smallest ( or minimum height ) bar . ' i ' is ' right ▁ index ' for the top and element before top in stack is 'left index
top_val = row [ result . pop ( ) ] NEW_LINE area = top_val * i NEW_LINE if ( len ( result ) ) : NEW_LINE INDENT area = top_val * ( i - result [ - 1 ] - 1 ) NEW_LINE DEDENT max_area = max ( area , max_area ) NEW_LINE