Now pop the remaining bars from stack and calculate area with every popped bar as the smallest bar
while ( ! result . empty ( ) ) { top_val = row [ result . top ( ) ] ; result . pop ( ) ; area = top_val * i ; if ( ! result . empty ( ) ) area = top_val * ( i - result . top ( ) - 1 ) ; max_area = max ( area , max_area ) ; } return max_area ; }