<doocs>0059.Spiral Matrix II_1.py
def generateMatrix( n: int) -> List[List[int]]:
    res = [[0] * n for _ in range(n)]
    num = 1
    m1, m2 = 0, n - 1
    while m1 < m2:
        for j in range(m1, m2):
            res[m1][j] = num
            num += 1
        for i in range(m1, m2):
            res[i][m2] = num
            num += 1
        for j in range(m2, m1, -1):
            res[m2][j] = num
            num += 1
        for i in range(m2, m1, -1):
            res[i][m1] = num
            num += 1
        m1 += 1
        m2 -= 1
    if m1 == m2:
        res[m1][m1] = num
    return res
def sample_funcname ( var_0 : int ) -> List [ List [ int ] ] :
    var_6 = [ [ 0 ] * var_0 for var_4 in range ( var_0 ) ]
    var_8 = 1
    var_9 , var_10 = 0 , var_0 - 1
    while var_9 < var_10 :
        for var_11 in range ( var_9 , var_10 ) :
            var_6 [ var_9 ] [ var_11 ] = var_8
            var_8 += 1
        for var_12 in range ( var_9 , var_10 ) :
            var_6 [ var_12 ] [ var_10 ] = var_8
            var_8 += 1
        for var_11 in range ( var_10 , var_9 , - 1 ) :
            var_6 [ var_10 ] [ var_11 ] = var_8
            var_8 += 1
        for var_12 in range ( var_10 , var_9 , - 1 ) :
            var_6 [ var_12 ] [ var_9 ] = var_8
            var_8 += 1
        var_9 += 1
        var_10 -= 1
    if var_9 == var_10 :
        var_6 [ var_9 ] [ var_9 ] = var_8
    return var_6
