구현 알고리즘 - 왕실의나이트
지난 포스팅에서 풀었던 상하좌우 알고리즘을 기초하여 풀었습니다. 이동할 수 있는 범위를 정해 놓고 좌표를 이동하면서 경우의 수를 체크하는것 입니다. def move(p): row = int(p[1]) column = int(ord(p[0])+1)-int(ord(p[0])) steps = [(-2,-1),(-1,-2),(1,-2),(1,2),(2,-1),(2,1),(-1,2),(-2,1)] result = 0 for step in steps: next_row = row + step[0] next_column = column + step[1] if next_row >=1 and next_row = 1 and next_column
2020. 11. 26.