Skip to content

旋转二维数组

r_grid = list(zip(*grid[::-1]))

输出:

    1 1 0 1 1 1 1 1 1 1
    1 1 1 1 1 1 0 1 1 1
    1 1 1 1 0 1 0 1 1 1
    1 0 1 1 1 1 1 1 1 1
    1 1 1 0 1 0 0 1 1 1
    1 1 0 1 1 1 1 1 1 1
    0 1 1 1 1 1 1 1 0 0
    1 1 1 0 1 1 1 1 0 1
    1 1 1 1 1 1 1 1 0 1
    1 1 1 1 1 1 1 1 0 1


    1 1 1 0 1 1 1 1 1 1
    1 1 1 1 1 1 0 1 1 1
    1 1 1 1 0 1 1 1 1 0
    1 1 0 1 1 0 1 1 1 1
    1 1 1 1 1 1 1 0 1 1
    1 1 1 1 1 0 1 1 1 1
    1 1 1 1 1 0 1 0 0 1
    1 1 1 1 1 1 1 1 1 1
    0 0 0 0 1 1 1 1 1 1
    1 1 1 0 1 1 1 1 1 1