1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/最小路径和 [0i0mDW].html

38 lines
1.2 KiB
HTML
Raw Normal View History

2022-03-27 20:38:29 +08:00
<p>给定一个包含非负整数的 <code><em>m</em>&nbsp;x&nbsp;<em>n</em></code>&nbsp;网格&nbsp;<code>grid</code> ,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。</p>
<p><strong>说明:</strong>一个机器人每次只能向下或者向右移动一步。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/11/05/minpath.jpg" style="width: 242px; height: 242px;" /></p>
<pre>
<strong>输入:</strong>grid = [[1,3,1],[1,5,1],[4,2,1]]
<strong>输出:</strong>7
<strong>解释:</strong>因为路径 1&rarr;3&rarr;1&rarr;1&rarr;1 的总和最小。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>grid = [[1,2,3],[4,5,6]]
<strong>输出:</strong>12
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>m == grid.length</code></li>
<li><code>n == grid[i].length</code></li>
<li><code>1 &lt;= m, n &lt;= 200</code></li>
<li><code>0 &lt;= grid[i][j] &lt;= 100</code></li>
</ul>
<p>&nbsp;</p>
<p><meta charset="UTF-8" />注意:本题与主站 64&nbsp;题相同:&nbsp;<a href="https://leetcode-cn.com/problems/minimum-path-sum/">https://leetcode-cn.com/problems/minimum-path-sum/</a></p>