Triangle
The problem is to find the minimum path sum from top to bottom if given a triangle. Each step you may move to adjacent numbers on the row below.
Input
triangle
: see example
Output
the minimum path sum
Examples
Example 1:
Input:
1triangle = [ 2 [2], 3 [3,4], 4 [6,5,7], 5 [4,1,8,3] 6] 7
Output: 11
Explanation:
The minimum path sum from top to bottom is 2 + 3 + 5 + 1 = 11
.
Try it yourself
Solution
Title
Script
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
Ipsum
has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
Contrary to popular belief, Lorem
Ipsum
is not simply random text.
1 >>> a = [1, 2, 3] 2 >>> a[-1] 3 3