Triangle
2015-09-14 08:44
176 查看
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).
Note: Bonus point if you are able to do this using only O(n) extra space, where n is the total number of
rows in the triangle.
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).
Note: Bonus point if you are able to do this using only O(n) extra space, where n is the total number of
rows in the triangle.
相关文章推荐
- Maximum Subarray
- CLRS 6.1堆
- raw和字符串的转换。
- 新浪微博-03 自定义导航栏控制器
- Best Time to Buy and Sell Stock II
- Longest Substring Without Repeating Characters
- Container With Most Water
- Jump Game
- Jump Game II
- Best Time to Buy and Sell Stock
- iOS开发网络数据之AFNetworking使用
- [置顶] 给IOS初学者及新手的建议
- modelandview 与modelmap
- Word Search
- Pow(x,n)
- Sqrt(x)
- 类和接口
- Sudoku Solver
- 一个关于autoLayout的非常详细的操作
- java计算两个时间相差(天、小时、分钟、秒)