2023-12-09 18:42:21 +08:00
|
|
|
|
<p>给定一个包含非负整数的 <code><em>m</em> x <em>n</em></code> 网格 <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> </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> </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 <= m, n <= 200</code></li>
|
|
|
|
|
<li><code>0 <= grid[i][j] <= 200</code></li>
|
2022-03-27 20:56:26 +08:00
|
|
|
|
</ul>
|