<qiyuangong>085_Maximal_Rectangle_1.py
def maximalRectangle( matrix):
    if matrix is None or len(matrix) == 0:
        return 0
    ls_row, ls_col = len(matrix), len(matrix[0])
    left, right, height = [0] * ls_col, [ls_col] * ls_col, [0] * ls_col
    maxA = 0
    for i in range(ls_row):
        curr_left, curr_right = 0, ls_col
        for j in range(ls_col):
            if matrix[i][j] == '1':
                height[j] += 1
            else:
                height[j] = 0
        for j in range(ls_col):
            if matrix[i][j] == '1':
                left[j] = max(left[j], curr_left)
            else:
                left[j], curr_left = 0, j + 1
        for j in range(ls_col - 1, -1, -1):
            if matrix[i][j] == '1':
                right[j] = min(right[j], curr_right)
            else:
                right[j], curr_right = ls_col, j
        for j in range(ls_col):
            maxA = max(maxA, (right[j] - left[j]) * height[j])
    return maxA
def sample_funcname ( var_0 ) :
    if var_0 is None or len ( var_0 ) == 0 :
        return 0
    var_4 , var_5 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_6 , var_7 , var_8 = [ 0 ] * var_5 , [ var_5 ] * var_5 , [ 0 ] * var_5
    var_9 = 0
    for var_11 in range ( var_4 ) :
        var_12 , var_13 = 0 , var_5
        for var_14 in range ( var_5 ) :
            if var_0 [ var_11 ] [ var_14 ] == '1' :
                var_8 [ var_14 ] += 1
            else :
                var_8 [ var_14 ] = 0
        for var_14 in range ( var_5 ) :
            if var_0 [ var_11 ] [ var_14 ] == '1' :
                var_6 [ var_14 ] = max ( var_6 [ var_14 ] , var_12 )
            else :
                var_6 [ var_14 ] , var_12 = 0 , var_14 + 1
        for var_14 in range ( var_5 - 1 , - 1 , - 1 ) :
            if var_0 [ var_11 ] [ var_14 ] == '1' :
                var_7 [ var_14 ] = min ( var_7 [ var_14 ] , var_13 )
            else :
                var_7 [ var_14 ] , var_13 = var_5 , var_14
        for var_14 in range ( var_5 ) :
            var_9 = max ( var_9 , ( var_7 [ var_14 ] - var_6 [ var_14 ] ) * var_8 [ var_14 ] )
    return var_9
