Triangle

Given a triangle array, return the minimum path sum from top to bottom. You can move to an adjacent number in the row below at each step.

Constraints

  • 1 <= triangle.length <= 200
  • triangle[0].length == 1
  • triangle[i].length == triangle[i - 1].length + 1
  • -10^4 <= triangle[i][j] <= 10^4
Auto-saved · 2 lines
class Solution:
def minimumTotal(self, triangle: List[List[int]]) -> int:
Console

Click Run to execute sample tests.