mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 22:13:28 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>有一幅以 <code>m x n</code> 的二维整数数组表示的图画 <code>image</code> ,其中 <code>image[i][j]</code> 表示该图画的像素值大小。</p>\n\n<p>你也被给予三个整数 <code>sr</code> , <code>sc</code> 和 <code>newColor</code> 。你应该从像素 <code>image[sr][sc]</code> 开始对图像进行 上色<strong>填充</strong> 。</p>\n\n<p>为了完成<strong> 上色工作</strong> ,从初始像素开始,记录初始坐标的 <strong>上下左右四个方向上</strong> 像素值与初始坐标相同的相连像素点,接着再记录这四个方向上符合条件的像素点与他们对应 <strong>四个方向上</strong> 像素值与初始坐标相同的相连像素点,……,重复该过程。将所有有记录的像素点的颜色值改为 <code>newColor</code> 。</p>\n\n<p>最后返回 <em>经过上色渲染后的图像 </em>。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img src=\"https://assets.leetcode.com/uploads/2021/06/01/flood1-grid.jpg\" /></p>\n\n<pre>\n<strong>输入:</strong> image = [[1,1,1],[1,1,0],[1,0,1]],sr = 1, sc = 1, newColor = 2\n<strong>输出:</strong> [[2,2,2],[2,2,0],[2,0,1]]\n<strong>解析:</strong> 在图像的正中间,(坐标(sr,sc)=(1,1)),在路径上所有符合条件的像素点的颜色都被更改成2。\n注意,右下角的像素没有更改为2,因为它不是在上下左右四个方向上与初始点相连的像素点。\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong> image = [[0,0,0],[0,0,0]], sr = 0, sc = 0, newColor = 2\n<strong>输出:</strong> [[2,2,2],[2,2,2]]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == image.length</code></li>\n\t<li><code>n == image[i].length</code></li>\n\t<li><code>1 <= m, n <= 50</code></li>\n\t<li><code>0 <= image[i][j], newColor < 2<sup>16</sup></code></li>\n\t<li><code>0 <= sr < m</code></li>\n\t<li><code>0 <= sc < n</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 302,
|
||||
"likes": 305,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Island Perimeter\", \"titleSlug\": \"island-perimeter\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u5c9b\\u5c7f\\u7684\\u5468\\u957f\"}]",
|
||||
@@ -155,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"99.3K\", \"totalSubmission\": \"171.4K\", \"totalAcceptedRaw\": 99281, \"totalSubmissionRaw\": 171392, \"acRate\": \"57.9%\"}",
|
||||
"stats": "{\"totalAccepted\": \"99.8K\", \"totalSubmission\": \"172.4K\", \"totalAcceptedRaw\": 99832, \"totalSubmissionRaw\": 172369, \"acRate\": \"57.9%\"}",
|
||||
"hints": [
|
||||
"Write a recursive function that paints the pixel if it's the correct color, then recurses on neighboring pixels."
|
||||
],
|
||||
|
Reference in New Issue
Block a user