Triangle
Find the minimum path sum in a triangle using bottom-up dynamic programming in O(n) space.
01The problem
Given a triangle array, return the minimum path sum from top to bottom.
For each step, you may move to an adjacent number of the row below. More formally, if you are on index c on the current row, you may move to either index c or index c + 1 on the next row.
Follow-up: Could you do this using only O(n) extra space, where n is the total number of rows in the triangle?
Loading the rest of the lesson…