프로그래머스 삼각달팽이
import itertools
def solution(n):
answer = [[0]*i for i in range(1,n+1)]
num = 1
for i in range((n+2)//3):
#n -1 + i*-3
iter_num = n -1 + i * -3
for j in range(i*2,i*2+iter_num):
answer[j][i] = num
num += 1
for j in range(i,iter_num+i):
answer[-(i+1)][j] = num
num += 1
for j in range(-(i+1),-iter_num-(i+1),-1):
answer[j][-(i+1)] = num
num += 1
if answer[i*2][i] == 0:
answer[i*2][i] = num
return list(itertools.chain(*answer))