mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
38 lines
1.2 KiB
HTML
38 lines
1.2 KiB
HTML
<p>给定一个包含非负整数的 <code><em>m</em> x <em>n</em></code> 网格 <code>grid</code> ,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。</p>
|
||
|
||
<p><strong>说明:</strong>一个机器人每次只能向下或者向右移动一步。</p>
|
||
|
||
<p> </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→3→1→1→1 的总和最小。
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>grid = [[1,2,3],[4,5,6]]
|
||
<strong>输出:</strong>12
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>m == grid.length</code></li>
|
||
<li><code>n == grid[i].length</code></li>
|
||
<li><code>1 <= m, n <= 200</code></li>
|
||
<li><code>0 <= grid[i][j] <= 100</code></li>
|
||
</ul>
|
||
|
||
<p> </p>
|
||
|
||
<p><meta charset="UTF-8" />注意:本题与主站 64 题相同: <a href="https://leetcode-cn.com/problems/minimum-path-sum/">https://leetcode-cn.com/problems/minimum-path-sum/</a></p>
|