LeetCode p64 Minimum Path Sum 题解
1.题目:
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
题意:
从一个矩阵的左上走到右下,找到那和最小的路线的值。
2.解题思路:
见代码,用dfs超时了TUT,以下借鉴了别人的算法思路。。感觉简洁多了。
3.代码
1 |
|