프로그래머스 - 행렬 테두리 회전하기


프로그래머스 - 행렬 테두리 회전하기

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051def rotate(y1,y2,x1,x2,graph): r = y1 c = x1 cnt = 0 tmp = graph[r+1][c] min_val = tmp while True: tmp2 = graph[r][c] graph[r][c] = tmp tmp = tmp2 if tmp < min_val: min_val = tmp if c == x2 and r == y1: cnt = 2 elif c == x2 and r == y2: cnt = 1 elif c == x1 and r == y2: cnt = 3 if cnt == 0: c += 1 elif cnt == 1: c -= 1 elif cnt == 2: r += 1 else: r -= 1 if r == y1 and c == x1: break return graph, min_val def solution(rows, columns, queries): answer = [] graph = [[0]*columns for _ in range(rows)] cnt..........



원문링크 : 프로그래머스 - 행렬 테두리 회전하기