mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-11 10:21:43 +08:00
存量题库数据更新
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
<p>给你一个大小为 <code>m x n</code> 的整数矩阵 <code>grid</code> ,表示一个网格。另给你三个整数 <code>row</code>、<code>col</code> 和 <code>color</code> 。网格中的每个值表示该位置处的网格块的颜色。</p>
|
||||
|
||||
<p>两个网格块属于同一 <strong>连通分量</strong> 需满足下述全部条件:</p>
|
||||
<p>如果两个方块在任意 4 个方向上相邻,则称它们 <strong>相邻 </strong>。</p>
|
||||
|
||||
<ul>
|
||||
<li>两个网格块颜色相同</li>
|
||||
<li>在上、下、左、右任意一个方向上相邻</li>
|
||||
</ul>
|
||||
<p>如果两个方块具有相同的颜色且相邻,它们则属于同一个 <strong>连通分量</strong> 。</p>
|
||||
|
||||
<p><strong>连通分量的边界</strong><strong> </strong>是指连通分量中满足下述条件之一的所有网格块:</p>
|
||||
|
||||
@@ -14,23 +11,25 @@
|
||||
<li>在网格的边界上(第一行/列或最后一行/列)</li>
|
||||
</ul>
|
||||
|
||||
<p>请你使用指定颜色 <code>color</code> 为所有包含网格块 <code>grid[row][col]</code> 的 <strong>连通分量的边界</strong> 进行着色,并返回最终的网格 <code>grid</code> 。</p>
|
||||
<p>请你使用指定颜色 <code>color</code> 为所有包含网格块 <code>grid[row][col]</code> 的 <strong>连通分量的边界</strong> 进行着色。</p>
|
||||
|
||||
<p>并返回最终的网格 <code>grid</code> 。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>grid = [[1,1],[1,2]], row = 0, col = 0, color = 3
|
||||
<strong>输出:</strong>[[3,3],[3,2]]</pre>
|
||||
|
||||
<p><strong>示例 2:</strong></p>
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>grid = [[1,2,2],[2,3,2]], row = 0, col = 1, color = 3
|
||||
<strong>输出:</strong>[[1,3,3],[2,3,3]]</pre>
|
||||
|
||||
<p><strong>示例 3:</strong></p>
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>grid = [[1,1,1],[1,1,1],[1,1,1]], row = 1, col = 1, color = 2
|
||||
@@ -48,5 +47,3 @@
|
||||
<li><code>0 <= row < m</code></li>
|
||||
<li><code>0 <= col < n</code></li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
Reference in New Issue
Block a user