Leetcode 120. Triangle Solution
Leetcode 120. Triangle Solution Hi everybody, Today we can discuss a Leetcode question. Question : 120. Triangle Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [ 2 ], [ 3 ,4], [6, 5 ,7], [4, 1 ,8,3] ] The minimum path sum from top to bottom is 11 (i.e., 2 + 3 + 5 + 1 = 11). We can start to understand the problem. First, we need to understand this question is a Dynamic Problem question. How? 1- We have a triangle. 2-) We need to traverse this triangle 3-) We can compute the min path through the Triangle. Second, we need to use an extra space like a 2 Dimensional array store to compute the adjacency number on the row below. Third, in the base case t raverse and general traverse case. The base case will traverse fill the left side of our 2D Array. The general traverse case will fill the inside of o...