We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f55fa18 commit 319b9c7Copy full SHA for 319b9c7
my-submissions/m120.py
@@ -0,0 +1,6 @@
1
+class Solution:
2
+ def minimumTotal(self, triangle: List[List[int]]) -> int:
3
+ curr = triangle[-1]
4
+ for r in range(len(triangle) - 2, -1, -1) :
5
+ curr = [triangle[r][i] + min(curr[i:i+2]) for i in range(len(triangle[r]))]
6
+ return curr[0]
0 commit comments