프로그래머스5 - 방의 개수
def solution(arrows): direction = [ [0,1], [1,1], [1,0], [1,-1], [0,-1], [-1,-1], [-1,0], [-1,1], ] answer = 0 dic = {} path = {} x, y = 0, 0 dic[str([x, y])] = True for item in arrows: for i in range(2) : nextx, nexty = x + direction[item][0], y + direction[item][1] pathKey = str([x, y, nextx, nexty]) pathKey2 = str([nextx, nexty, x, y]) dicKey = str([nextx, nexty]) if not dicKey in dic : path[..
더보기