From 69b93bd9bc62061298e0d1be6f854dfbd2aa86d6 Mon Sep 17 00:00:00 2001 From: acbin <44314231+acbin@users.noreply.github.com> Date: Tue, 2 Jan 2024 06:17:50 +0000 Subject: [PATCH 1/2] feat: update lc problems --- .../0006.Zigzag Conversion/README.md | 2 +- .../0100-0199/0195.Tenth Line/README_EN.md | 15 ----- .../README.md | 21 ++++--- .../README.md | 2 +- .../README.md | 14 ++--- .../README_EN.md | 2 +- .../README.md | 14 +++-- .../README.md | 8 +-- .../1216.Valid Palindrome III/README.md | 2 +- .../README.md | 39 ++++--------- .../images/1703052515-HqjAJq-chess1.jpg | Bin 0 -> 53274 bytes .../images/1703052660-bPPflt-chess2.jpg | Bin 0 -> 54813 bytes .../images/chess1.jpg | Bin 0 -> 53274 bytes .../images/chess2.jpg | Bin 0 -> 54813 bytes .../README.md | 2 +- .../README_EN.md | 2 +- .../README.md | 53 ++++++------------ .../2668.Find Latest Salaries/README_EN.md | 2 +- .../2735.Collecting Chocolates/README.md | 2 +- .../2978.Symmetric Coordinates/README.md | 2 +- .../2978.Symmetric Coordinates/README_EN.md | 2 +- .../README.md | 30 +++++----- .../2989.Class Performance/README.md | 39 ++++++------- solution/2900-2999/2990.Loan Types/README.md | 33 +++++------ solution/DATABASE_README.md | 4 +- solution/README.md | 6 +- solution/database-summary.md | 4 +- solution/summary.md | 6 +- 28 files changed, 134 insertions(+), 172 deletions(-) create mode 100644 solution/1200-1299/1222.Queens That Can Attack the King/images/1703052515-HqjAJq-chess1.jpg create mode 100644 solution/1200-1299/1222.Queens That Can Attack the King/images/1703052660-bPPflt-chess2.jpg create mode 100644 solution/1200-1299/1222.Queens That Can Attack the King/images/chess1.jpg create mode 100644 solution/1200-1299/1222.Queens That Can Attack the King/images/chess2.jpg diff --git a/solution/0000-0099/0006.Zigzag Conversion/README.md b/solution/0000-0099/0006.Zigzag Conversion/README.md index 13abffed28316..637033263a9a1 100644 --- a/solution/0000-0099/0006.Zigzag Conversion/README.md +++ b/solution/0000-0099/0006.Zigzag Conversion/README.md @@ -1,4 +1,4 @@ -# [6. N 字形变换](https://leetcode.cn/problems/zigzag-conversion) +# [6. Z 字形变换](https://leetcode.cn/problems/zigzag-conversion) [English Version](/solution/0000-0099/0006.Zigzag%20Conversion/README_EN.md) diff --git a/solution/0100-0199/0195.Tenth Line/README_EN.md b/solution/0100-0199/0195.Tenth Line/README_EN.md index f8e0d5ad36d86..67c2637df5b2f 100644 --- a/solution/0100-0199/0195.Tenth Line/README_EN.md +++ b/solution/0100-0199/0195.Tenth Line/README_EN.md @@ -11,41 +11,26 @@
Assume that file.txt
has the following content:
- Line 1 - Line 2 - Line 3 - Line 4 - Line 5 - Line 6 - Line 7 - Line 8 - Line 9 - Line 10 -
Your script should output the tenth line, which is:
- Line 10 -
给你一个由一些多米诺骨牌组成的列表 dominoes
。
给你一组多米诺骨牌 dominoes
。
如果其中某一张多米诺骨牌可以通过旋转 0
度或 180
度得到另一张多米诺骨牌,我们就认为这两张牌是等价的。
形式上,dominoes[i] = [a, b]
和 dominoes[j] = [c, d]
等价的前提是 a==c
且 b==d
,或是 a==d
且 b==c
。
形式上,dominoes[i] = [a, b]
与 dominoes[j] = [c, d]
等价 当且仅当 (a == c
且 b == d
) 或者 (a == d
且 b == c
) 。即一张骨牌可以通过旋转 0
度或 180
度得到另一张多米诺骨牌。
在 0 <= i < j < dominoes.length
的前提下,找出满足 dominoes[i]
和 dominoes[j]
等价的骨牌对 (i, j)
的数量。
-
示例:
+示例 1:
-输入:dominoes = [[1,2],[2,1],[3,4],[5,6]] ++输入:dominoes = [[1,2],[2,1],[3,4],[5,6]] 输出:1+示例 2:
+ ++输入:dominoes = [[1,2],[1,2],[1,1],[1,2],[2,2]] +输出:3 ++
提示:
1 <= dominoes.length <= 40000
1 <= dominoes.length <= 4 * 104
dominoes[i].length == 2
1 <= dominoes[i][j] <= 9
这里有 n
个一样的骰子,每个骰子上都有 k
个面,分别标号为 1
到 k
。
给定三个整数 n
, k
和 target
,返回可能的方式(从总共 kn
种方式中)滚动骰子的数量,使正面朝上的数字之和等于 target
。
给定三个整数 n
、k
和 target
,请返回投掷骰子的所有可能得到的结果(共有 kn
种方式),使得骰子面朝上的数字总和等于 target
。
答案可能很大,你需要对 109 + 7
取模 。
由于答案可能很大,你需要对 109 + 7
取模。
@@ -19,8 +19,8 @@
输入:n = 1, k = 6, target = 3 输出:1 -解释:你扔一个有 6 个面的骰子。 -得到 3 的和只有一种方法。 +解释:你掷了一个有 6 个面的骰子。 +得到总和为 3 的结果的方式只有一种。
示例 2:
@@ -28,8 +28,8 @@输入:n = 2, k = 6, target = 7 输出:6 -解释:你扔两个骰子,每个骰子有 6 个面。 -得到 7 的和有 6 种方法:1+6 2+5 3+4 4+3 5+2 6+1。 +解释:你掷了两个骰子,每个骰子有 6 个面。 +有 6 种方式得到总和为 7 的结果: 1+6, 2+5, 3+4, 4+3, 5+2, 6+1。
示例 3:
@@ -37,7 +37,7 @@输入:n = 30, k = 30, target = 500 输出:222616187 -解释:返回的结果必须是对 109 + 7 取模。+解释:返回的结果必须对 109 + 7 取模。
diff --git a/solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README_EN.md b/solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README_EN.md index 7253d9bc61d61..5e766dfd9d706 100644 --- a/solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README_EN.md +++ b/solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README_EN.md @@ -4,7 +4,7 @@ ## Description -
You have n
dice, and each die has k
faces numbered from 1
to k
.
You have n
dice, and each dice has k
faces numbered from 1
to k
.
Given three integers n
, k
, and target
, return the number of possible ways (out of the kn
total ways) to roll the dice, so the sum of the face-up numbers equals target
. Since the answer may be too large, return it modulo 109 + 7
.
示例 1:
-输入:words = ["cat","bt","hat","tree"], chars = "atach" ++输入:words = ["cat","bt","hat","tree"], chars = "atach" 输出:6 解释: -可以形成字符串 "cat" 和 "hat",所以答案是 3 + 3 = 6。 +可以形成字符串 "cat" 和 "hat",所以答案是 3 + 3 = 6。示例 2:
-输入:words = ["hello","world","leetcode"], chars = "welldonehoneyr" ++输入:words = ["hello","world","leetcode"], chars = "welldonehoneyr" 输出:10 解释: -可以形成字符串 "hello" 和 "world",所以答案是 5 + 5 = 10。 +可以形成字符串 "hello" 和 "world",所以答案是 5 + 5 = 10。
提示:
-+
+ ## 解法 diff --git a/solution/1100-1199/1167.Minimum Cost to Connect Sticks/README.md b/solution/1100-1199/1167.Minimum Cost to Connect Sticks/README.md index 3c2cd91fb254f..d7b5bccd7e762 100644 --- a/solution/1100-1199/1167.Minimum Cost to Connect Sticks/README.md +++ b/solution/1100-1199/1167.Minimum Cost to Connect Sticks/README.md @@ -1,4 +1,4 @@ -# [1167. 连接棒材的最低费用](https://leetcode.cn/problems/minimum-cost-to-connect-sticks) +# [1167. 连接木棍的最低费用](https://leetcode.cn/problems/minimum-cost-to-connect-sticks) [English Version](/solution/1100-1199/1167.Minimum%20Cost%20to%20Connect%20Sticks/README_EN.md) @@ -6,11 +6,11 @@ -
1 <= words.length <= 1000
1 <= words[i].length, chars.length <= 100
- 所有字符串中都仅包含小写英文字母
-你有一些长度为正整数的棍子。这些长度以数组
+sticks
的形式给出,sticks[i]
是第i个
木棍的长度。你有一些长度为正整数的木棍。这些长度以数组
-sticks
的形式给出,sticks[i]
是第i
个木棍的长度。你可以通过支付
+x + y
的成本将任意两个长度为x
和y
的棍子连接成一个棍子。你必须连接所有的棍子,直到剩下一个棍子。你可以通过支付
-x + y
的成本将任意两个长度为x
和y
的木棍连接成一个木棍。你必须连接所有的木棍,直到剩下一个木棍。返回以这种方式将所有给定的棍子连接成一个棍子的 最小成本 。
+返回以这种方式将所有给定的木棍连接成一个木棍的 最小成本 。
diff --git a/solution/1200-1299/1216.Valid Palindrome III/README.md b/solution/1200-1299/1216.Valid Palindrome III/README.md index 1bd8868cfe3bc..6d84520fd58da 100644 --- a/solution/1200-1299/1216.Valid Palindrome III/README.md +++ b/solution/1200-1299/1216.Valid Palindrome III/README.md @@ -1,4 +1,4 @@ -# [1216. 验证回文字符串 III](https://leetcode.cn/problems/valid-palindrome-iii) +# [1216. 验证回文串 III](https://leetcode.cn/problems/valid-palindrome-iii) [English Version](/solution/1200-1299/1216.Valid%20Palindrome%20III/README_EN.md) diff --git a/solution/1200-1299/1222.Queens That Can Attack the King/README.md b/solution/1200-1299/1222.Queens That Can Attack the King/README.md index 476b65aaf38e6..f248650f19907 100644 --- a/solution/1200-1299/1222.Queens That Can Attack the King/README.md +++ b/solution/1200-1299/1222.Queens That Can Attack the King/README.md @@ -6,57 +6,42 @@ -
在一个 8x8 的棋盘上,放置着若干「黑皇后」和一个「白国王」。
+在一个 下标从 0 开始 的
-8 x 8
棋盘上,可能有多个黑皇后和一个白国王。给定一个由整数坐标组成的数组
+queens
,表示黑皇后的位置;以及一对坐标king
,表示白国王的位置,返回所有可以攻击国王的皇后的坐标(任意顺序)。给你一个二维整数数组
+ +queens
,其中queens[i] = [xQueeni, yQueeni]
表示第i
个黑皇后在棋盘上的位置。还给你一个长度为2
的整数数组king
,其中king = [xKing, yKing]
表示白国王的位置。返回 能够直接攻击国王的黑皇后的坐标。你可以以 任何顺序 返回答案。
示例 1:
-+
输入:queens = [[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]], king = [0,0] 输出:[[0,1],[1,0],[3,3]] -解释: -[0,1] 的皇后可以攻击到国王,因为他们在同一行上。 -[1,0] 的皇后可以攻击到国王,因为他们在同一列上。 -[3,3] 的皇后可以攻击到国王,因为他们在同一条对角线上。 -[0,4] 的皇后无法攻击到国王,因为她被位于 [0,1] 的皇后挡住了。 -[4,0] 的皇后无法攻击到国王,因为她被位于 [1,0] 的皇后挡住了。 -[2,4] 的皇后无法攻击到国王,因为她和国王不在同一行/列/对角线上。 +解释:上面的图示显示了三个可以直接攻击国王的皇后和三个不能攻击国王的皇后(用红色虚线标记)。示例 2:
-+
输入:queens = [[0,0],[1,1],[2,2],[3,4],[3,5],[4,4],[4,5]], king = [3,3] 输出:[[2,2],[3,4],[4,4]] -- -示例 3:
- -- -
-输入: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] -输出:[[2,3],[1,4],[1,6],[3,7],[4,3],[5,4],[4,5]] -+解释:上面的图示显示了三个能够直接攻击国王的黑皇后和三个不能攻击国王的黑皇后(用红色虚线标记)。
提示:
1 <= queens.length <= 63
queens[i].length == 2
0 <= queens[i][j] < 8
king.length == 2
0 <= king[0], king[1] < 8
1 <= queens.length < 64
queens[i].length == king.length == 2
0 <= xQueeni, yQueeni, xKing, yKing < 8