blob: fcf09d1a9cc8768312e482bc830c44d8a2cd50df (
plain)
1
2
3
4
5
6
7
8
9
10
|
def min_sum_path(A):
memo = [None] * len(A)
n = len(A) - 1
for i in range(len(A[n])):
memo[i] = A[n][i]
for i in range(len(A) - 2, -1,-1):
for j in range( len(A[i])):
memo[j] = A[i][j] + min(memo[j],
memo[j + 1])
return memo[0]
|