Problem
A triangle of numbers has one value in row 0, two in row 1, and so on. Start at the top and move down one row at a time. From index i in a row you may step to index `i` or `i + 1` in the row below. Return the minimum path sum from top to bottom.
Example 1
triangle = [[2],
Example 2
[3, 4],
Example 3
[6, 5, 7],
Example 4
- Input
- [4, 1, 8, 3]]
- Output
- 11
- Why
- 2 + 3 + 5 + 1
Example 5
- Input
- triangle = [[-10]]
- Output
- -10
Constraints
1 <= triangle.length <= 200triangle[0].length == 1 and triangle[i].length == triangle[i - 1].length + 1-10^4 <= triangle[i][j] <= 10^4