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)/最小路径和 [minimum-path-sum].html

32 lines
1.0 KiB
HTML
Raw Normal View History

2023-12-09 18:42:21 +08:00
<p>给定一个包含非负整数的 <code><em>m</em>&nbsp;x&nbsp;<em>n</em></code>&nbsp;网格&nbsp;<code>grid</code> ,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。</p>
2022-03-27 20:56:26 +08:00
<p><strong>说明:</strong>每次只能向下或者向右移动一步。</p>
2023-12-09 18:42:21 +08:00
<p>&nbsp;</p>
2022-03-27 20:56:26 +08:00
2023-12-09 18:42:21 +08:00
<p><strong class="example">示例 1</strong></p>
2022-03-27 20:56:26 +08:00
<img alt="" src="https://assets.leetcode.com/uploads/2020/11/05/minpath.jpg" style="width: 242px; height: 242px;" />
<pre>
<strong>输入:</strong>grid = [[1,3,1],[1,5,1],[4,2,1]]
<strong>输出:</strong>7
<strong>解释:</strong>因为路径 1→3→1→1→1 的总和最小。
</pre>
2023-12-09 18:42:21 +08:00
<p><strong class="example">示例 2</strong></p>
2022-03-27 20:56:26 +08:00
<pre>
<strong>输入:</strong>grid = [[1,2,3],[4,5,6]]
<strong>输出:</strong>12
</pre>
2023-12-09 18:42:21 +08:00
<p>&nbsp;</p>
2022-03-27 20:56:26 +08:00
<p><strong>提示:</strong></p>
<ul>
<li><code>m == grid.length</code></li>
<li><code>n == grid[i].length</code></li>
2023-12-09 18:42:21 +08:00
<li><code>1 &lt;= m, n &lt;= 200</code></li>
<li><code>0 &lt;= grid[i][j] &lt;= 200</code></li>
2022-03-27 20:56:26 +08:00
</ul>