Skip to content

Instantly share code, notes, and snippets.

@inspirit941
Created January 14, 2020 12:52
Show Gist options
  • Save inspirit941/0bccbb10e42a5a1f5a52593d106d2646 to your computer and use it in GitHub Desktop.
Save inspirit941/0bccbb10e42a5a1f5a52593d106d2646 to your computer and use it in GitHub Desktop.
def solution(land):
for row in range(1, len(land)):
# 밟을 칸(index) 선택
for i in range(4):
# 밟은 칸 제외한 나머지 칸
rest = set(range(4)) - {i}
# 밟은 칸 제외한 나머지 칸들의 최댓값을 다음 row의 index에 저장.
land[row][i] += max([land[row-1][index] for index in rest])
# 마지막 row에서 얻을 수 있는 점수의 최댓값을 확인한다.
return max(land[-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment