Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 0 additions & 15 deletions
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‎

Lines changed: 14 additions & 7 deletions
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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 7 additions & 7 deletions
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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 8 additions & 6 deletions
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‎

Lines changed: 4 additions & 4 deletions
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‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 12 additions & 27 deletions
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
## 解法

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /