You are given a triangle of numbers as an array triangle. Row 0 has 1 number, row 1 has 2 numbers, and so on. Start at the top and walk to the bottom. Return the smallest sum of the numbers on your path.
From a number at position i in one row, you can step to position i or position i + 1 in the next row.
Examples
Example 1:
Input: triangle = [[1],[2,3],[4,5,6],[7,8,9,1]]
Output: 11
Explanation: The best path is 1 + 3 + 6 + 1 = 11.
Example 2:
Input: triangle = [[8]]
Output: 8
Explanation: The triangle has only the top number.