<qiyuangong>221_Maximal_Square_1.py
def maximalSquare( matrix):
    if matrix is None or len(matrix) == 0:
        return 0
    rows, cols = len(matrix), len(matrix[0])
    res = 0
    for i in range(rows):
        for j in range(cols):
            if matrix[i][j] == '1':
                sqlen, flag = 1, True
                while sqlen + i < rows and sqlen + j < cols and flag:
                    for k in range(j, sqlen + j + 1):
                        if matrix[i + sqlen][k] == '0':
                            flag = False
                            break
                    for k in range(i, sqlen + i + 1):
                        if matrix[k][j + sqlen] == '0':
                            flag = False
                            break
                    if flag:
                        sqlen += 1
                if res < sqlen:
                    res = sqlen
    return res * res
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 = 0
    for var_8 in range ( var_4 ) :
        for var_9 in range ( var_5 ) :
            if var_0 [ var_8 ] [ var_9 ] == '1' :
                var_12 , var_14 = 1 , True
                while var_12 + var_8 < var_4 and var_12 + var_9 < var_5 and var_14 :
                    for var_15 in range ( var_9 , var_12 + var_9 + 1 ) :
                        if var_0 [ var_8 + var_12 ] [ var_15 ] == '0' :
                            var_14 = False
                            break
                    for var_15 in range ( var_8 , var_12 + var_8 + 1 ) :
                        if var_0 [ var_15 ] [ var_9 + var_12 ] == '0' :
                            var_14 = False
                            break
                    if var_14 :
                        var_12 += 1
                if var_6 < var_12 :
                    var_6 = var_12
    return var_6 * var_6
