1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-21 21:16:45 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

移除零宽空格

This commit is contained in:
2025-09-28 16:53:26 +08:00
parent 440092a4c3
commit 2862a227c4
43 changed files with 52 additions and 52 deletions

View File

@@ -7,7 +7,7 @@
"boundTopicId": 3746533,
"title": "Flip Square Submatrix Vertically",
"titleSlug": "flip-square-submatrix-vertically",
"content": "<p>You are given an <code>m x n</code> integer matrix <code>grid</code>, and three integers <code>x</code>, <code>y</code>, and <code>k</code>.</p>\n\n<p>The integers <code>x</code> and <code>y</code> represent the row and column indices of the <strong>top-left</strong> corner of a <strong>square</strong> submatrix and the integer <code>k</code> represents the size (side length) of the square submatrix.</p>\n\n<p>Your task is to flip the submatrix by reversing the order of its rows vertically.</p>\n\n<p>Return the updated matrix.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2025/07/20/gridexmdrawio.png\" style=\"width: 300px; height: 116px;\" />\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">grid = </span>[[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]<span class=\"example-io\">, x = 1, y = 0, k = 3</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">[[1,2,3,4],[13,14,15,8],[9,10,11,12],[5,6,7,16]]</span></p>\n\n<p><strong>Explanation:</strong></p>\n\n<p>The diagram above shows the grid before and after the transformation.</p>\n</div>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2025/07/20/gridexm2drawio.png\" style=\"width: 350px; height: 68px;\" />\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">grid = [[3,4,2,3],[2,3,4,2]], x = 0, y = 2, k = 2</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">[[3,4,4,2],[2,3,2,3]]</span></p>\n\n<p><strong>Explanation:</strong></p>\n\n<p>The diagram above shows the grid before and after the transformation.</p>\n</div>\n\n<p>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>m == grid.length</code></li>\n\t<li><code>n == grid[i].length</code></li>\n\t<li><code>1 &lt;= m, n &lt;= 50</code></li>\n\t<li><code>1 &lt;= grid[i][j] &lt;= 100</code></li>\n\t<li><code>0 &lt;= x &lt; m</code></li>\n\t<li><code>0 &lt;= y &lt; n</code></li>\n\t<li><code>1 &lt;= k &lt;= min(m - x, n - y)</code></li>\n</ul>\n",
"content": "<p>You are given an <code>m x n</code> integer matrix <code>grid</code>, and three integers <code>x</code>, <code>y</code>, and <code>k</code>.</p>\n\n<p>The integers <code>x</code> and <code>y</code> represent the row and column indices of the <strong>top-left</strong> corner of a <strong>square</strong> submatrix and the integer <code>k</code> represents the size (side length) of the square submatrix.</p>\n\n<p>Your task is to flip the submatrix by reversing the order of its rows vertically.</p>\n\n<p>Return the updated matrix.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2025/07/20/gridexmdrawio.png\" style=\"width: 300px; height: 116px;\" />\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">grid = </span>[[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]<span class=\"example-io\">, x = 1, y = 0, k = 3</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">[[1,2,3,4],[13,14,15,8],[9,10,11,12],[5,6,7,16]]</span></p>\n\n<p><strong>Explanation:</strong></p>\n\n<p>The diagram above shows the grid before and after the transformation.</p>\n</div>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2025/07/20/gridexm2drawio.png\" style=\"width: 350px; height: 68px;\" />\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">grid = [[3,4,2,3],[2,3,4,2]], x = 0, y = 2, k = 2</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">[[3,4,4,2],[2,3,2,3]]</span></p>\n\n<p><strong>Explanation:</strong></p>\n\n<p>The diagram above shows the grid before and after the transformation.</p>\n</div>\n\n<p>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>m == grid.length</code></li>\n\t<li><code>n == grid[i].length</code></li>\n\t<li><code>1 &lt;= m, n &lt;= 50</code></li>\n\t<li><code>1 &lt;= grid[i][j] &lt;= 100</code></li>\n\t<li><code>0 &lt;= x &lt; m</code></li>\n\t<li><code>0 &lt;= y &lt; n</code></li>\n\t<li><code>1 &lt;= k &lt;= min(m - x, n - y)</code></li>\n</ul>\n",
"translatedTitle": "垂直翻转子矩阵",
"translatedContent": "<p>给你一个 <code>m x n</code> 的整数矩阵 <code>grid</code>,以及三个整数 <code>x</code>、<code>y</code> 和 <code>k</code>。</p>\n\n<p>整数 <code>x</code> 和 <code>y</code> 表示一个&nbsp;<strong>正方形子矩阵&nbsp;</strong>的左上角下标,整数 <code>k</code> 表示该正方形子矩阵的边长。</p>\n\n<p>你的任务是垂直翻转子矩阵的行顺序。</p>\n\n<p>返回更新后的矩阵。</p>\n\n<p>&nbsp;</p>\n\n<p><strong class=\"example\">示例 1</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2025/07/20/gridexmdrawio.png\" style=\"width: 300px; height: 116px;\" />\n<div class=\"example-block\">\n<p><strong>输入:</strong> <span class=\"example-io\">grid = </span>[[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]<span class=\"example-io\">, x = 1, y = 0, k = 3</span></p>\n\n<p><strong>输出:</strong> <span class=\"example-io\">[[1,2,3,4],[13,14,15,8],[9,10,11,12],[5,6,7,16]]</span></p>\n\n<p><strong>解释:</strong></p>\n\n<p>上图展示了矩阵在变换前后的样子。</p>\n</div>\n\n<p><strong class=\"example\">示例 2</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2025/07/20/gridexm2drawio.png\" style=\"width: 350px; height: 68px;\" />\n<div class=\"example-block\">\n<p><strong>输入:</strong> <span class=\"example-io\">grid = [[3,4,2,3],[2,3,4,2]], x = 0, y = 2, k = 2</span></p>\n\n<p><strong>输出:</strong> <span class=\"example-io\">[[3,4,4,2],[2,3,2,3]]</span></p>\n\n<p><strong>解释:</strong></p>\n\n<p>上图展示了矩阵在变换前后的样子。</p>\n</div>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>m == grid.length</code></li>\n\t<li><code>n == grid[i].length</code></li>\n\t<li><code>1 &lt;= m, n &lt;= 50</code></li>\n\t<li><code>1 &lt;= grid[i][j] &lt;= 100</code></li>\n\t<li><code>0 &lt;= x &lt; m</code></li>\n\t<li><code>0 &lt;= y &lt; n</code></li>\n\t<li><code>1 &lt;= k &lt;= min(m - x, n - y)</code></li>\n</ul>\n",
"isPaidOnly": false,