Skip to content

Commit 8077754

Browse files
acbinidoocs
andauthored
feat: update lc problems (doocs#2173)
--------- Co-authored-by: Doocs Bot <doocs-bot@outlook.com>
1 parent 75b76e8 commit 8077754

File tree

28 files changed

+134
-172
lines changed

28 files changed

+134
-172
lines changed

solution/0000-0099/0006.Zigzag Conversion/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [6. N 字形变换](https://leetcode.cn/problems/zigzag-conversion)
1+
# [6. Z 字形变换](https://leetcode.cn/problems/zigzag-conversion)
22

33
[English Version](/solution/0000-0099/0006.Zigzag%20Conversion/README_EN.md)
44

solution/0100-0199/0195.Tenth Line/README_EN.md

-15
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,26 @@
1111
<p>Assume that <code>file.txt</code> has the following content:</p>
1212

1313
<pre>
14-
1514
Line 1
16-
1715
Line 2
18-
1916
Line 3
20-
2117
Line 4
22-
2318
Line 5
24-
2519
Line 6
26-
2720
Line 7
28-
2921
Line 8
30-
3122
Line 9
32-
3323
Line 10
34-
3524
</pre>
3625

3726
<p>Your script should output the tenth line, which is:</p>
3827

3928
<pre>
40-
4129
Line 10
42-
4330
</pre>
4431

4532
<div class="spoilers"><b>Note:</b><br />
46-
4733
1. If the file contains less than 10 lines, what should you output?<br />
48-
4934
2. There&#39;s at least three different solutions. Try to explore all possibilities.</div>
5035

5136
## Solutions

solution/1100-1199/1128.Number of Equivalent Domino Pairs/README.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,35 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>给你一个由一些多米诺骨牌组成的列表&nbsp;<code>dominoes</code>。</p>
9+
<p>给你一组多米诺骨牌 <code>dominoes</code> 。</p>
1010

11-
<p>如果其中某一张多米诺骨牌可以通过旋转 <code>0</code>&nbsp;度或 <code>180</code> 度得到另一张多米诺骨牌,我们就认为这两张牌是等价的。</p>
12-
13-
<p>形式上,<code>dominoes[i] = [a, b]</code>&nbsp;&nbsp;<code>dominoes[j] = [c, d]</code>&nbsp;等价的前提是&nbsp;<code>a==c</code>&nbsp;&nbsp;<code>b==d</code>,或是&nbsp;<code>a==d</code> 且&nbsp;<code>b==c</code>。</p>
11+
<p>形式上,<code>dominoes[i] = [a, b]</code> 与 <code>dominoes[j] = [c, d]</code> <strong>等价</strong> 当且仅当 (<code>a == c</code> 且 <code>b == d</code>) 或者 (<code>a == d</code> 且 <code>b == c</code>) 。即一张骨牌可以通过旋转 <code>0</code>&nbsp;度或 <code>180</code> 度得到另一张多米诺骨牌。</p>
1412

1513
<p>在&nbsp;<code>0 &lt;= i &lt; j &lt; dominoes.length</code>&nbsp;的前提下,找出满足&nbsp;<code>dominoes[i]</code> 和&nbsp;<code>dominoes[j]</code>&nbsp;等价的骨牌对 <code>(i, j)</code> 的数量。</p>
1614

1715
<p>&nbsp;</p>
1816

19-
<p><strong>示例:</strong></p>
17+
<p><strong>示例 1:</strong></p>
2018

21-
<pre><strong>输入:</strong>dominoes = [[1,2],[2,1],[3,4],[5,6]]
19+
<pre>
20+
<strong>输入:</strong>dominoes = [[1,2],[2,1],[3,4],[5,6]]
2221
<strong>输出:</strong>1
2322
</pre>
2423

24+
<p><strong>示例 2:</strong></p>
25+
26+
<pre>
27+
<strong>输入:</strong>dominoes = [[1,2],[1,2],[1,1],[1,2],[2,2]]
28+
<strong>输出:</strong>3
29+
</pre>
30+
2531
<p>&nbsp;</p>
2632

2733
<p><strong>提示:</strong></p>
2834

2935
<ul>
30-
<li><code>1 &lt;= dominoes.length &lt;= 40000</code></li>
36+
<li><code>1 &lt;= dominoes.length &lt;= 4 * 10<sup>4</sup></code></li>
37+
<li><code>dominoes[i].length == 2</code></li>
3138
<li><code>1 &lt;= dominoes[i][j] &lt;= 9</code></li>
3239
</ul>
3340

solution/1100-1199/1135.Connecting Cities With Minimum Cost/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [1135. 最低成本联通所有城市](https://leetcode.cn/problems/connecting-cities-with-minimum-cost)
1+
# [1135. 最低成本连通所有城市](https://leetcode.cn/problems/connecting-cities-with-minimum-cost)
22

33
[English Version](/solution/1100-1199/1135.Connecting%20Cities%20With%20Minimum%20Cost/README_EN.md)
44

solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
<p>这里有&nbsp;<code>n</code>&nbsp;个一样的骰子,每个骰子上都有&nbsp;<code>k</code>&nbsp;个面,分别标号为&nbsp;<code>1</code>&nbsp;到 <code>k</code> 。</p>
1010

11-
<p>给定三个整数 <code>n</code> ,&nbsp; <code>k</code> 和&nbsp;<code>target</code>&nbsp;,返回可能的方式(从总共<em>&nbsp;</em><code>k<sup>n</sup></code><em>&nbsp;</em>种方式中)滚动骰子的数量,使正面朝上的数字之和等于<em>&nbsp;</em><code>target</code>&nbsp;。</p>
11+
<p>给定三个整数 <code>n</code><code>k</code> 和 <code>target</code>,请返回投掷骰子的所有可能得到的结果(共有 <code>k<sup>n</sup></code> 种方式),使得骰子面朝上的数字总和等于 <code>target</code>。</p>
1212

13-
<p>答案可能很大,你需要对&nbsp;<code>10<sup>9</sup>&nbsp;+ 7</code> <strong>取模</strong>&nbsp;。</p>
13+
<p>由于答案可能很大,你需要对 <code>10<sup>9</sup> + 7</code> <strong>取模</strong>。</p>
1414

1515
<p>&nbsp;</p>
1616

@@ -19,25 +19,25 @@
1919
<pre>
2020
<strong>输入:</strong>n = 1, k = 6, target = 3
2121
<strong>输出:</strong>1
22-
<strong>解释:</strong>你扔一个有 6 个面的骰子。
23-
得到 3 的和只有一种方法
22+
<strong>解释:</strong>你掷了一个有 6 个面的骰子。
23+
得到总和为 3 的结果的方式只有一种
2424
</pre>
2525

2626
<p><strong>示例 2:</strong></p>
2727

2828
<pre>
2929
<strong>输入:</strong>n = 2, k = 6, target = 7
3030
<strong>输出:</strong>6
31-
<strong>解释:</strong>你扔两个骰子,每个骰子有 6 个面。
32-
得到 7 的和有 6 种方法:1+6 2+5 3+4 4+3 5+2 6+1。
31+
<strong>解释:</strong>你掷了两个骰子,每个骰子有 6 个面。
32+
有 6 种方式得到总和为 7 的结果: 1+6, 2+5, 3+4, 4+3, 5+2, 6+1。
3333
</pre>
3434

3535
<p><strong>示例 3:</strong></p>
3636

3737
<pre>
3838
<strong>输入:</strong>n = 30, k = 30, target = 500
3939
<strong>输出:</strong>222616187
40-
<strong>解释:</strong>返回的结果必须是对 10<sup>9</sup> + 7 取模。</pre>
40+
<strong>解释:</strong>返回的结果必须对 10<sup>9</sup> + 7 取模。</pre>
4141

4242
<p>&nbsp;</p>
4343

solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Description
66

7-
<p>You have <code>n</code> dice, and each die has <code>k</code> faces numbered from <code>1</code> to <code>k</code>.</p>
7+
<p>You have <code>n</code> dice, and each dice has <code>k</code> faces numbered from <code>1</code> to <code>k</code>.</p>
88

99
<p>Given three integers <code>n</code>, <code>k</code>, and <code>target</code>, return <em>the number of possible ways (out of the </em><code>k<sup>n</sup></code><em> total ways) </em><em>to roll the dice, so the sum of the face-up numbers equals </em><code>target</code>. Since the answer may be too large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
1010

solution/1100-1199/1160.Find Words That Can Be Formed by Characters/README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,31 @@
1818

1919
<p><strong>示例 1:</strong></p>
2020

21-
<pre><strong>输入:</strong>words = [&quot;cat&quot;,&quot;bt&quot;,&quot;hat&quot;,&quot;tree&quot;], chars = &quot;atach&quot;
21+
<pre>
22+
<strong>输入:</strong>words = ["cat","bt","hat","tree"], chars = "atach"
2223
<strong>输出:</strong>6
2324
<strong>解释: </strong>
24-
可以形成字符串 &quot;cat&quot;&quot;hat&quot;,所以答案是 3 + 3 = 6。
25+
可以形成字符串 "cat""hat",所以答案是 3 + 3 = 6。
2526
</pre>
2627

2728
<p><strong>示例 2:</strong></p>
2829

29-
<pre><strong>输入:</strong>words = [&quot;hello&quot;,&quot;world&quot;,&quot;leetcode&quot;], chars = &quot;welldonehoneyr&quot;
30+
<pre>
31+
<strong>输入:</strong>words = ["hello","world","leetcode"], chars = "welldonehoneyr"
3032
<strong>输出:</strong>10
3133
<strong>解释:</strong>
32-
可以形成字符串 &quot;hello&quot;&quot;world&quot;,所以答案是 5 + 5 = 10。
34+
可以形成字符串 "hello""world",所以答案是 5 + 5 = 10。
3335
</pre>
3436

3537
<p>&nbsp;</p>
3638

3739
<p><strong>提示:</strong></p>
3840

39-
<ol>
41+
<ul>
4042
<li><code>1 &lt;= words.length &lt;= 1000</code></li>
4143
<li><code>1 &lt;= words[i].length, chars.length&nbsp;&lt;= 100</code></li>
4244
<li>所有字符串中都仅包含小写英文字母</li>
43-
</ol>
45+
</ul>
4446

4547
## 解法
4648

solution/1100-1199/1167.Minimum Cost to Connect Sticks/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# [1167. 连接棒材的最低费用](https://leetcode.cn/problems/minimum-cost-to-connect-sticks)
1+
# [1167. 连接木棍的最低费用](https://leetcode.cn/problems/minimum-cost-to-connect-sticks)
22

33
[English Version](/solution/1100-1199/1167.Minimum%20Cost%20to%20Connect%20Sticks/README_EN.md)
44

55
## 题目描述
66

77
<!-- 这里写题目描述 -->
88

9-
<p>你有一些长度为正整数的棍子。这些长度以数组<meta charset="UTF-8" />&nbsp;<code>sticks</code>&nbsp;的形式给出,<meta charset="UTF-8" />&nbsp;<code>sticks[i]</code>&nbsp; <code>第i个</code> 木棍的长度。</p>
9+
<p>你有一些长度为正整数的木棍。这些长度以数组<meta charset="UTF-8" />&nbsp;<code>sticks</code>&nbsp;的形式给出,<meta charset="UTF-8" />&nbsp;<code>sticks[i]</code>&nbsp;是第 <code>i</code> 个木棍的长度。</p>
1010

11-
<p>你可以通过支付 <code>x + y</code> 的成本将任意两个长度为 <code>x</code> 和 <code>y</code> 的棍子连接成一个棍子。你必须连接所有的棍子,直到剩下一个棍子。</p>
11+
<p>你可以通过支付 <code>x + y</code> 的成本将任意两个长度为 <code>x</code> 和 <code>y</code> 的木棍连接成一个木棍。你必须连接所有的木棍,直到剩下一个木棍。</p>
1212

13-
<p>返回以这种方式将所有给定的棍子连接成一个棍子的 <em>最小成本</em> 。</p>
13+
<p>返回以这种方式将所有给定的木棍连接成一个木棍的<em> 最小成本 </em>。</p>
1414

1515
<p>&nbsp;</p>
1616

solution/1200-1299/1216.Valid Palindrome III/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [1216. 验证回文字符串 III](https://leetcode.cn/problems/valid-palindrome-iii)
1+
# [1216. 验证回文串 III](https://leetcode.cn/problems/valid-palindrome-iii)
22

33
[English Version](/solution/1200-1299/1216.Valid%20Palindrome%20III/README_EN.md)
44

solution/1200-1299/1222.Queens That Can Attack the King/README.md

+12-27
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,42 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>在一个&nbsp;<strong>8x8</strong>&nbsp;的棋盘上,放置着若干「黑皇后」和一个「白国王」。</p>
9+
<p>在一个 <strong>下标从 0 开始</strong> 的 <code>8 x 8</code> 棋盘上,可能有多个黑皇后和一个白国王。</p>
1010

11-
<p>给定一个由整数坐标组成的数组&nbsp;<code>queens</code>&nbsp;,表示黑皇后的位置;以及一对坐标&nbsp;<code>king</code> ,表示白国王的位置,返回所有可以攻击国王的皇后的坐标(任意顺序)。</p>
11+
<p>给你一个二维整数数组 <code>queens</code>,其中 <code>queens[i] = [xQueeni, yQueeni]</code> 表示第 <code>i</code> 个黑皇后在棋盘上的位置。还给你一个长度为 <code>2</code> 的整数数组 <code>king</code>,其中 <code>king = [xKing, yKing]</code> 表示白国王的位置。</p>
12+
13+
<p>返回 <em>能够直接攻击国王的黑皇后的坐标</em>。你可以以 <strong>任何顺序</strong> 返回答案。</p>
1214

1315
<p>&nbsp;</p>
1416

1517
<p><strong>示例 1:</strong></p>
1618

17-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1200-1299/1222.Queens%20That%20Can%20Attack%20the%20King/images/untitled-diagram.jpg" /></p>
19+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1200-1299/1222.Queens%20That%20Can%20Attack%20the%20King/images/1703052515-HqjAJq-chess1.jpg" style="width: 400px; height: 400px;" /></p>
1820

1921
<pre>
2022
<strong>输入:</strong>queens = [[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]], king = [0,0]
2123
<strong>输出:</strong>[[0,1],[1,0],[3,3]]
22-
<strong>解释:</strong>
23-
[0,1] 的皇后可以攻击到国王,因为他们在同一行上。
24-
[1,0] 的皇后可以攻击到国王,因为他们在同一列上。
25-
[3,3] 的皇后可以攻击到国王,因为他们在同一条对角线上。
26-
[0,4] 的皇后无法攻击到国王,因为她被位于 [0,1] 的皇后挡住了。
27-
[4,0] 的皇后无法攻击到国王,因为她被位于 [1,0] 的皇后挡住了。
28-
[2,4] 的皇后无法攻击到国王,因为她和国王不在同一行/列/对角线上。
24+
<strong>解释:</strong>上面的图示显示了三个可以直接攻击国王的皇后和三个不能攻击国王的皇后(用红色虚线标记)。
2925
</pre>
3026

3127
<p><strong>示例 2:</strong></p>
3228

33-
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1200-1299/1222.Queens%20That%20Can%20Attack%20the%20King/images/untitled-diagram-1.jpg" /></strong></p>
29+
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1200-1299/1222.Queens%20That%20Can%20Attack%20the%20King/images/1703052660-bPPflt-chess2.jpg" style="width: 400px; height: 400px;" /></strong></p>
3430

3531
<pre>
3632
<strong>输入:</strong>queens = [[0,0],[1,1],[2,2],[3,4],[3,5],[4,4],[4,5]], king = [3,3]
3733
<strong>输出:</strong>[[2,2],[3,4],[4,4]]
38-
</pre>
39-
40-
<p><strong>示例 3:</strong></p>
41-
42-
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1200-1299/1222.Queens%20That%20Can%20Attack%20the%20King/images/untitled-diagram-2.jpg" /></strong></p>
43-
44-
<pre>
45-
<strong>输入:</strong>queens = [[5,6],[7,7],[2,1],[0,7],[1,6],[5,1],[3,7],[0,3],[4,0],[1,2],[6,3],[5,0],[0,4],[2,2],[1,1],[6,4],[5,4],[0,0],[2,6],[4,5],[5,2],[1,4],[7,5],[2,3],[0,5],[4,2],[1,0],[2,7],[0,1],[4,6],[6,1],[0,6],[4,3],[1,7]], king = [3,4]
46-
<strong>输出:</strong>[[2,3],[1,4],[1,6],[3,7],[4,3],[5,4],[4,5]]
47-
</pre>
34+
<strong>解释:</strong>上面的图示显示了三个能够直接攻击国王的黑皇后和三个不能攻击国王的黑皇后(用红色虚线标记)。</pre>
4835

4936
<p>&nbsp;</p>
5037

5138
<p><strong>提示:</strong></p>
5239

5340
<ul>
54-
<li><code>1 &lt;= queens.length&nbsp;&lt;= 63</code></li>
55-
<li><code>queens[i].length == 2</code></li>
56-
<li><code>0 &lt;= queens[i][j] &lt;&nbsp;8</code></li>
57-
<li><code>king.length == 2</code></li>
58-
<li><code>0 &lt;= king[0], king[1] &lt; 8</code></li>
59-
<li>一个棋盘格上最多只能放置一枚棋子。</li>
41+
<li><meta charset="UTF-8" /><code>1 &lt;= queens.length &lt; 64</code></li>
42+
<li><code>queens[i].length == king.length == 2</code></li>
43+
<li><code>0 &lt;= xQueen<sub>i</sub>, yQueen<sub>i</sub>, xKing, yKing &lt; 8</code></li>
44+
<li>所有给定的位置都是 <strong>唯一</strong> 的。</li>
6045
</ul>
6146

6247
## 解法
Loading
Loading
Loading
Loading

solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<p>Alice 把 <code>n</code> 个气球排列在一根绳子上。给你一个下标从 <strong>0</strong> 开始的字符串 <code>colors</code> ,其中 <code>colors[i]</code> 是第 <code>i</code> 个气球的颜色。</p>
1010

11-
<p>Alice 想要把绳子装扮成 <strong>彩色</strong> ,且她不希望两个连续的气球涂着相同的颜色,所以她喊来 Bob 帮忙。Bob 可以从绳子上移除一些气球使绳子变成 <strong>彩色</strong> 。给你一个下标从 <strong>0</strong> 开始的整数数组 <code>neededTime</code> ,其中 <code>neededTime[i]</code> 是 Bob 从绳子上移除第 <code>i</code> 个气球需要的时间(以秒为单位)。</p>
11+
<p>Alice 想要把绳子装扮成 <b>五颜六色的</b>&nbsp;,且她不希望两个连续的气球涂着相同的颜色,所以她喊来 Bob 帮忙。Bob 可以从绳子上移除一些气球使绳子变成 <strong>彩色</strong> 。给你一个 <strong>下标从 0 开始&nbsp;</strong>的整数数组 <code>neededTime</code> ,其中 <code>neededTime[i]</code> 是 Bob 从绳子上移除第 <code>i</code> 个气球需要的时间(以秒为单位)。</p>
1212

1313
<p>返回 Bob 使绳子变成 <strong>彩色</strong> 需要的 <strong>最少时间</strong> 。</p>
1414

solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ There are no longer two consecutive balloons of the same color. Total time = 3.<
3333
<pre>
3434
<strong>Input:</strong> colors = &quot;aabaa&quot;, neededTime = [1,2,3,4,1]
3535
<strong>Output:</strong> 2
36-
<strong>Explanation:</strong> Bob will remove the ballons at indices 0 and 4. Each ballon takes 1 second to remove.
36+
<strong>Explanation:</strong> Bob will remove the balloons at indices 0 and 4. Each balloons takes 1 second to remove.
3737
There are no longer two consecutive balloons of the same color. Total time = 1 + 1 = 2.
3838
</pre>
3939

solution/1500-1599/1582.Special Positions in a Binary Matrix/README.md

+16-37
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,37 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>给你一个大小为 <code>rows x cols</code> 的矩阵 <code>mat</code>,其中 <code>mat[i][j]</code> 是 <code>0</code> 或 <code>1</code>,请返回 <strong>矩阵&nbsp;<em><code>mat</code></em> 中特殊位置的数目</strong> 。</p>
9+
<p>给定一个 <code>m x n</code> 的二进制矩阵 <code>mat</code>,返回矩阵 <code>mat</code> 中特殊位置的数量。</p>
1010

11-
<p><strong>特殊位置</strong> 定义:如果 <code>mat[i][j] == 1</code> 并且第 <code>i</code> 行和第 <code>j</code> 列中的所有其他元素均为 <code>0</code>(行和列的下标均 <strong>从 0 开始</strong> ),则位置 <code>(i, j)</code> 被称为特殊位置。</p>
11+
<p>如果位置 <code>(i, j)</code> 满足 <code>mat[i][j] == 1</code> 并且行 <code>i</code> 与列 <code>j</code> 中的所有其他元素都是 <code>0</code>(行和列的下标从 <strong>0 </strong>开始计数),那么它被称为<strong> 特殊 </strong>位置。</p>
1212

1313
<p>&nbsp;</p>
1414

15-
<p><strong>示例 1:</strong></p>
16-
17-
<pre><strong>输入:</strong>mat = [[1,0,0],
18-
&nbsp; [0,0,<strong>1</strong>],
19-
&nbsp; [1,0,0]]
15+
<p><strong class="example">示例 1:</strong></p>
16+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1500-1599/1582.Special%20Positions%20in%20a%20Binary%20Matrix/images/special1.jpg" style="width: 244px; height: 245px;" />
17+
<pre>
18+
<strong>输入:</strong>mat = [[1,0,0],[0,0,1],[1,0,0]]
2019
<strong>输出:</strong>1
21-
<strong>解释:</strong>(1,2) 是一个特殊位置,因为 mat[1][2] == 1 且所处的行和列上所有其他元素都是 0
22-
</pre>
23-
24-
<p><strong>示例 2:</strong></p>
25-
26-
<pre><strong>输入:</strong>mat = [[<strong>1</strong>,0,0],
27-
&nbsp; [0,<strong>1</strong>,0],
28-
&nbsp; [0,0,<strong>1</strong>]]
29-
<strong>输出:</strong>3
30-
<strong>解释:</strong>(0,0), (1,1) 和 (2,2) 都是特殊位置
20+
<strong>解释:</strong>位置 (1, 2) 是一个特殊位置,因为 mat[1][2] == 1 且第 1 行和第 2 列的其他所有元素都是 0。
3121
</pre>
3222

33-
<p><strong>示例 3:</strong></p>
34-
35-
<pre><strong>输入:</strong>mat = [[0,0,0,<strong>1</strong>],
36-
&nbsp; [<strong>1</strong>,0,0,0],
37-
&nbsp; [0,1,1,0],
38-
&nbsp; [0,0,0,0]]
39-
<strong>输出:</strong>2
40-
</pre>
41-
42-
<p><strong>示例 4:</strong></p>
43-
44-
<pre><strong>输入:</strong>mat = [[0,0,0,0,0],
45-
&nbsp; [<strong>1</strong>,0,0,0,0],
46-
&nbsp; [0,<strong>1</strong>,0,0,0],
47-
&nbsp; [0,0,<strong>1</strong>,0,0],
48-
&nbsp; [0,0,0,1,1]]
23+
<p><strong class="example">示例 2:</strong></p>
24+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1500-1599/1582.Special%20Positions%20in%20a%20Binary%20Matrix/images/special-grid.jpg" style="width: 244px; height: 245px;" />
25+
<pre>
26+
<strong>输入:</strong>mat = [[1,0,0],[0,1,0],[0,0,1]]
4927
<strong>输出:</strong>3
28+
<strong>解释:</strong>位置 (0, 0),(1, 1) 和 (2, 2) 都是特殊位置。
5029
</pre>
5130

5231
<p>&nbsp;</p>
5332

5433
<p><strong>提示:</strong></p>
5534

5635
<ul>
57-
<li><code>rows == mat.length</code></li>
58-
<li><code>cols == mat[i].length</code></li>
59-
<li><code>1 &lt;= rows, cols &lt;= 100</code></li>
60-
<li><code>mat[i][j]</code> 是 <code>0</code> 或 <code>1</code></li>
36+
<li><code>m == mat.length</code></li>
37+
<li><code>n == mat[i].length</code></li>
38+
<li><code>1 &lt;= m, n &lt;= 100</code></li>
39+
<li><code>mat[i][j]</code> 是 <code>0</code> 或 <code>1</code></li>
6140
</ul>
6241

6342
## 解法

solution/2600-2699/2668.Find Latest Salaries/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Each row contains employees details and their yearly salaries, however, some of
6060
</strong>
6161
<strong>Explanation:</strong>
6262
- emp_id 1 has two records with a salary of&nbsp;110000, 106119 out of these 110000 is an updated salary (Assuming salary is increasing each year)
63-
- emp_id 2 has two records with a salary of&nbsp;128922, 128922&nbsp;out of these 130000 is an updated salary.
63+
- emp_id 2 has two records with a salary of&nbsp;128922, 130000&nbsp;out of these 130000 is an updated salary.
6464
- emp_id 3 has only one salary record so that is already an updated salary.
6565
- emp_id 4&nbsp;has two records with a salary of&nbsp;162825, 170000&nbsp;out of these 170000 is an updated salary.
6666
- emp_id 5&nbsp;has only one salary record so that is already an updated salary.

solution/2700-2799/2735.Collecting Chocolates/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>给你一个长度为 <code>n</code> 、下标从 <strong>0</strong> 开始的整数数组 <code>nums</code> ,表示收集不同巧克力的成本。每个巧克力都对应一个不同的类型,最初,位于下标 <code>i</code> 的巧克力就对应第 <code>i</code> 个类型。</p>
9+
<p>给你一个长度为 <code>n</code>、下标从 <strong>0</strong> 开始的整数数组 <code>nums</code>,<code>nums[i]</code> 表示收集位于下标 <code>i</code> 处的巧克力成本。每个巧克力都对应一个不同的类型,最初,位于下标 <code>i</code> 的巧克力就对应第 <code>i</code> 个类型。</p>
1010

1111
<p>在一步操作中,你可以用成本 <code>x</code> 执行下述行为:</p>
1212

0 commit comments

Comments
 (0)