DevYoon
[ํ๋ก๊ทธ๋๋จธ์ค] ์ ์ ์ผ๊ฐํ (Python) ๋ณธ๋ฌธ
link ๐ https://programmers.co.kr/learn/courses/30/lessons/43105
def solution(triangle):
ret = [[0]*len(triangle[i]) for i in range(len(triangle))]
ret[0][0] = triangle[0][0]
for y in range(len(ret)-1):
for x in range(len(triangle[y])):
ret[y+1][x] = max(ret[y+1][x], triangle[y+1][x]+ret[y][x])
ret[y+1][x+1] = max(ret[y+1][x+1], triangle[y+1][x+1]+ret[y][x])
return max(ret[len(triangle)-1])