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
-
 
Note:
- 1. If the file contains less than 10 lines, what should you output?
- 2. There's at least three different solutions. Try to explore all possibilities.
## Solutions diff --git a/solution/1100-1199/1128.Number of Equivalent Domino Pairs/README.md b/solution/1100-1199/1128.Number of Equivalent Domino Pairs/README.md index b3ab3559988a4..3fd3150a88919 100644 --- a/solution/1100-1199/1128.Number of Equivalent Domino Pairs/README.md +++ b/solution/1100-1199/1128.Number of Equivalent Domino Pairs/README.md @@ -6,28 +6,35 @@ -

给你一个由一些多米诺骨牌组成的列表 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 == cb == d) 或者 (a == db == 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
+
+

 

提示:

diff --git a/solution/1100-1199/1135.Connecting Cities With Minimum Cost/README.md b/solution/1100-1199/1135.Connecting Cities With Minimum Cost/README.md index 8955b07c69285..ff24c3be096e2 100644 --- a/solution/1100-1199/1135.Connecting Cities With Minimum Cost/README.md +++ b/solution/1100-1199/1135.Connecting Cities With Minimum Cost/README.md @@ -1,4 +1,4 @@ -# [1135. 最低成本联通所有城市](https://leetcode.cn/problems/connecting-cities-with-minimum-cost) +# [1135. 最低成本连通所有城市](https://leetcode.cn/problems/connecting-cities-with-minimum-cost) [English Version](/solution/1100-1199/1135.Connecting%20Cities%20With%20Minimum%20Cost/README_EN.md) diff --git a/solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README.md b/solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README.md index 3d74d9a636a80..fc38f973b5b64 100644 --- a/solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README.md +++ b/solution/1100-1199/1155.Number of Dice Rolls With Target Sum/README.md @@ -8,9 +8,9 @@

这里有 n 个一样的骰子,每个骰子上都有 k 个面,分别标号为 1 到 k

-

给定三个整数 nk 和 target ,返回可能的方式(从总共 kn 种方式中)滚动骰子的数量,使正面朝上的数字之和等于 target 。

+

给定三个整数 nktarget,请返回投掷骰子的所有可能得到的结果(共有 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.

diff --git a/solution/1100-1199/1160.Find Words That Can Be Formed by Characters/README.md b/solution/1100-1199/1160.Find Words That Can Be Formed by Characters/README.md index 11be54a46b377..ea8e5600e2dcf 100644 --- a/solution/1100-1199/1160.Find Words That Can Be Formed by Characters/README.md +++ b/solution/1100-1199/1160.Find Words That Can Be Formed by Characters/README.md @@ -18,29 +18,31 @@

示例 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。
 

 

提示:

-
    +
    • 1 <= words.length <= 1000
    • 1 <= words[i].length, chars.length <= 100
    • 所有字符串中都仅包含小写英文字母
    • -
+ ## 解法 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 @@ -

你有一些长度为正整数的棍子。这些长度以数组 sticks 的形式给出, sticks[i] 是 第i个 木棍的长度。

+

你有一些长度为正整数的木棍。这些长度以数组 sticks 的形式给出, sticks[i] 是第 i 个木棍的长度。

-

你可以通过支付 x + y 的成本将任意两个长度为 xy 的棍子连接成一个棍子。你必须连接所有的棍子,直到剩下一个棍子。

+

你可以通过支付 x + y 的成本将任意两个长度为 xy 的木棍连接成一个木棍。你必须连接所有的木棍,直到剩下一个木棍。

-

返回以这种方式将所有给定的棍子连接成一个棍子的 最小成本

+

返回以这种方式将所有给定的木棍连接成一个木棍的 最小成本

 

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]]
-
+解释:上面的图示显示了三个能够直接攻击国王的黑皇后和三个不能攻击国王的黑皇后(用红色虚线标记)。

 

提示:

## 解法 diff --git a/solution/1200-1299/1222.Queens That Can Attack the King/images/1703052515-HqjAJq-chess1.jpg b/solution/1200-1299/1222.Queens That Can Attack the King/images/1703052515-HqjAJq-chess1.jpg new file mode 100644 index 0000000000000..d805a7cdf3c36 Binary files /dev/null and b/solution/1200-1299/1222.Queens That Can Attack the King/images/1703052515-HqjAJq-chess1.jpg differ diff --git a/solution/1200-1299/1222.Queens That Can Attack the King/images/1703052660-bPPflt-chess2.jpg b/solution/1200-1299/1222.Queens That Can Attack the King/images/1703052660-bPPflt-chess2.jpg new file mode 100644 index 0000000000000..95e1599bd942a Binary files /dev/null and b/solution/1200-1299/1222.Queens That Can Attack the King/images/1703052660-bPPflt-chess2.jpg differ diff --git a/solution/1200-1299/1222.Queens That Can Attack the King/images/chess1.jpg b/solution/1200-1299/1222.Queens That Can Attack the King/images/chess1.jpg new file mode 100644 index 0000000000000..d805a7cdf3c36 Binary files /dev/null and b/solution/1200-1299/1222.Queens That Can Attack the King/images/chess1.jpg differ diff --git a/solution/1200-1299/1222.Queens That Can Attack the King/images/chess2.jpg b/solution/1200-1299/1222.Queens That Can Attack the King/images/chess2.jpg new file mode 100644 index 0000000000000..95e1599bd942a Binary files /dev/null and b/solution/1200-1299/1222.Queens That Can Attack the King/images/chess2.jpg differ diff --git a/solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README.md b/solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README.md index 8562be3f81dd8..179c3f12f8b2c 100644 --- a/solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README.md +++ b/solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README.md @@ -8,7 +8,7 @@

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

-

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

+

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

返回 Bob 使绳子变成 彩色 需要的 最少时间

diff --git a/solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README_EN.md b/solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README_EN.md index aba9cfa446b2f..ec67d48fc5756 100644 --- a/solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README_EN.md +++ b/solution/1500-1599/1578.Minimum Time to Make Rope Colorful/README_EN.md @@ -33,7 +33,7 @@ There are no longer two consecutive balloons of the same color. Total time = 3.<
 Input: colors = "aabaa", neededTime = [1,2,3,4,1]
 Output: 2
-Explanation: Bob will remove the ballons at indices 0 and 4. Each ballon takes 1 second to remove.
+Explanation: Bob will remove the balloons at indices 0 and 4. Each balloons takes 1 second to remove.
 There are no longer two consecutive balloons of the same color. Total time = 1 + 1 = 2.
 
diff --git a/solution/1500-1599/1582.Special Positions in a Binary Matrix/README.md b/solution/1500-1599/1582.Special Positions in a Binary Matrix/README.md index 7455882a15609..e2dca4701539b 100644 --- a/solution/1500-1599/1582.Special Positions in a Binary Matrix/README.md +++ b/solution/1500-1599/1582.Special Positions in a Binary Matrix/README.md @@ -6,47 +6,26 @@ -

给你一个大小为 rows x cols 的矩阵 mat,其中 mat[i][j]01,请返回 矩阵 mat 中特殊位置的数目

+

给定一个 m x n 的二进制矩阵 mat,返回矩阵 mat 中特殊位置的数量。

-

特殊位置 定义:如果 mat[i][j] == 1 并且第 i 行和第 j 列中的所有其他元素均为 0(行和列的下标均 从 0 开始 ),则位置 (i, j) 被称为特殊位置。

+

如果位置 (i, j) 满足 mat[i][j] == 1 并且行 i 与列 j 中的所有其他元素都是 0(行和列的下标从 0 开始计数),那么它被称为 特殊 位置。

 

-

示例 1:

- -
输入:mat = [[1,0,0],
-            [0,0,1],
-            [1,0,0]]
+

示例 1:

+ +
+输入:mat = [[1,0,0],[0,0,1],[1,0,0]]
 输出:1
-解释:(1,2) 是一个特殊位置,因为 mat[1][2] == 1 且所处的行和列上所有其他元素都是 0
-
- -

示例 2:

- -
输入:mat = [[1,0,0],
-            [0,1,0],
-            [0,0,1]]
-输出:3
-解释:(0,0), (1,1) 和 (2,2) 都是特殊位置
+解释:位置 (1, 2) 是一个特殊位置,因为 mat[1][2] == 1 且第 1 行和第 2 列的其他所有元素都是 0。
 
-

示例 3:

- -
输入:mat = [[0,0,0,1],
-            [1,0,0,0],
-            [0,1,1,0],
-            [0,0,0,0]]
-输出:2
-
- -

示例 4:

- -
输入:mat = [[0,0,0,0,0],
-            [1,0,0,0,0],
-            [0,1,0,0,0],
-            [0,0,1,0,0],
-            [0,0,0,1,1]]
+

示例 2:

+ +
+输入:mat = [[1,0,0],[0,1,0],[0,0,1]]
 输出:3
+解释:位置 (0, 0),(1, 1) 和 (2, 2) 都是特殊位置。
 

 

@@ -54,10 +33,10 @@

提示:

    -
  • rows == mat.length
  • -
  • cols == mat[i].length
  • -
  • 1 <= rows, cols <= 100
  • -
  • mat[i][j]01
  • +
  • m == mat.length
  • +
  • n == mat[i].length
  • +
  • 1 <= m, n <= 100
  • +
  • mat[i][j]01
## 解法 diff --git a/solution/2600-2699/2668.Find Latest Salaries/README_EN.md b/solution/2600-2699/2668.Find Latest Salaries/README_EN.md index 12899562fdb29..ef9b5b429c4d9 100644 --- a/solution/2600-2699/2668.Find Latest Salaries/README_EN.md +++ b/solution/2600-2699/2668.Find Latest Salaries/README_EN.md @@ -60,7 +60,7 @@ Each row contains employees details and their yearly salaries, however, some of Explanation: - emp_id 1 has two records with a salary of 110000, 106119 out of these 110000 is an updated salary (Assuming salary is increasing each year) -- emp_id 2 has two records with a salary of 128922, 128922 out of these 130000 is an updated salary. +- emp_id 2 has two records with a salary of 128922, 130000 out of these 130000 is an updated salary. - emp_id 3 has only one salary record so that is already an updated salary. - emp_id 4 has two records with a salary of 162825, 170000 out of these 170000 is an updated salary. - emp_id 5 has only one salary record so that is already an updated salary. diff --git a/solution/2700-2799/2735.Collecting Chocolates/README.md b/solution/2700-2799/2735.Collecting Chocolates/README.md index c5f2c8d8be6f0..991f493892795 100644 --- a/solution/2700-2799/2735.Collecting Chocolates/README.md +++ b/solution/2700-2799/2735.Collecting Chocolates/README.md @@ -6,7 +6,7 @@ -

给你一个长度为 n 、下标从 0 开始的整数数组 nums ,表示收集不同巧克力的成本。每个巧克力都对应一个不同的类型,最初,位于下标 i 的巧克力就对应第 i 个类型。

+

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

在一步操作中,你可以用成本 x 执行下述行为:

diff --git a/solution/2900-2999/2978.Symmetric Coordinates/README.md b/solution/2900-2999/2978.Symmetric Coordinates/README.md index 71682a74e2df1..158c1273bcff6 100644 --- a/solution/2900-2999/2978.Symmetric Coordinates/README.md +++ b/solution/2900-2999/2978.Symmetric Coordinates/README.md @@ -6,7 +6,7 @@ -

Table: Pairs

+

Table: Coordinates

 +-------------+------+
diff --git a/solution/2900-2999/2978.Symmetric Coordinates/README_EN.md b/solution/2900-2999/2978.Symmetric Coordinates/README_EN.md
index 0c82807ed7482..c4431de2a274e 100644
--- a/solution/2900-2999/2978.Symmetric Coordinates/README_EN.md	
+++ b/solution/2900-2999/2978.Symmetric Coordinates/README_EN.md	
@@ -4,7 +4,7 @@
 
 ## Description
 
-

Table: Pairs

+

Table: Coordinates

 +-------------+------+
diff --git a/solution/2900-2999/2979.Most Expensive Item That Can Not Be Bought/README.md b/solution/2900-2999/2979.Most Expensive Item That Can Not Be Bought/README.md
index 4ca26c2b6d603..5cefc537853f8 100644
--- a/solution/2900-2999/2979.Most Expensive Item That Can Not Be Bought/README.md	
+++ b/solution/2900-2999/2979.Most Expensive Item That Can Not Be Bought/README.md	
@@ -1,4 +1,4 @@
-# [2979. Most Expensive Item That Can Not Be Bought](https://leetcode.cn/problems/most-expensive-item-that-can-not-be-bought)
+# [2979. 最贵的无法购买的商品](https://leetcode.cn/problems/most-expensive-item-that-can-not-be-bought)
 
 [English Version](/solution/2900-2999/2979.Most%20Expensive%20Item%20That%20Can%20Not%20Be%20Bought/README_EN.md)
 
@@ -6,35 +6,37 @@
 
 
 
-

You are given two distinct prime numbers primeOne and primeTwo.

+

给定两个 不同的质数 primeOne 和 primeTwo

-

Alice and Bob are visiting a market. The market has an infinite number of items, for any positive integer x there exists an item whose price is x. Alice wants to buy some items from the market to gift to Bob. She has an infinite number of coins in the denomination primeOne and primeTwo. She wants to know the most expensive item she can not buy to gift to Bob.

+

Alice 和 Bob 正在逛市场。该市场有 无数种 商品,对于 任何 正整数 x,都存在一个价格为 x 的物品。Alice 想从市场里买一些东西送给 Bob。她有 无数个 面值为 primeOneprimeTwo 的硬币。她想知道她 无法 用她拥有的硬币购买的 最贵 商品的价格。

-

Return the price of the most expensive item which Alice can not gift to Bob.

+

返回 Alice 无法买给 Bob 的 最贵 商品的价格。

 

-

Example 1:

+ +

示例 1:

-Input: primeOne = 2, primeTwo = 5
-Output: 3
-Explanation: The prices of items which cannot be bought are [1,3]. It can be shown that all items with a price greater than 3 can be bought using a combination of coins of denominations 2 and 5.
+输入:primeOne = 2, primeTwo = 5
+输出:3
+解释:无法购买的商品的价格有 [1,3]。所有价格大于 3 的商品都可以通过组合使用面额为 2 和 5 的硬币购买。
 
-

Example 2:

+

示例 2:

-Input: primeOne = 5, primeTwo = 7
-Output: 23
-Explanation: The prices of items which cannot be bought are [1,2,3,4,6,8,9,11,13,16,18,23]. It can be shown that all items with a price greater than 23 can be bought.
+输入:primeOne = 5, primeTwo = 7
+输出:23
+解释:无法购买的商品的价格有 [1,2,3,4,6,8,9,11,13,16,18,23]。所有价格大于 23 的商品都可以购买。
 

 

-

Constraints:

+ +

提示:

  • 1 < primeOne, primeTwo < 104
  • -
  • primeOne, primeTwo are prime numbers.
  • +
  • primeOne, primeTwo 都是质数。
  • primeOne * primeTwo < 105
diff --git a/solution/2900-2999/2989.Class Performance/README.md b/solution/2900-2999/2989.Class Performance/README.md index 08d586d23adc3..1c84d39e80dbc 100644 --- a/solution/2900-2999/2989.Class Performance/README.md +++ b/solution/2900-2999/2989.Class Performance/README.md @@ -1,4 +1,4 @@ -# [2989. Class Performance](https://leetcode.cn/problems/class-performance) +# [2989. 班级表现](https://leetcode.cn/problems/class-performance) [English Version](/solution/2900-2999/2989.Class%20Performance/README_EN.md) @@ -6,7 +6,7 @@ -

Table: Scores

+

表: Scores

 +--------------+---------+
@@ -18,22 +18,23 @@
 | assignment2  | int     |
 | assignment3  | int     |
 +--------------+---------+
-student_id is column of unique values for this table.
-This table contains student_id, student_name, assignment1, assignment2, and assignment3.
+student_id 是这张表具有唯一值的列。
+该表包含 student_id, student_name, assignment1, assignment2,和 assignment3。
 
-

Write a solution to calculate the difference in the total score (sum of all 3 assignments) between the highest score obtained by students and the lowest score obtained by them.

+

编写一个查询,计算学生获得的 最高分 和 最低分 之间的 总分差3 次作业的总和)。

-

Return the result table in any order.

+

任意 顺序返回结果表。

-

The result format is in the following example.

+

结果表的格式如下示例所示。

 

-

Example 1:

+ +

示例 1:

-Input: 
-Scores table:
+输入:
+Scores 表:
 +------------+--------------+-------------+-------------+-------------+
 | student_id | student_name | assignment1 | assignment2 | assignment3 |
 +------------+--------------+-------------+-------------+-------------+
@@ -44,20 +45,20 @@ Scores table:
 | 896        | David        | 32          | 37          | 50          | 
 | 235        | Camila       | 31          | 53          | 69          | 
 +------------+--------------+-------------+-------------+-------------+
-Output
+输出
 +---------------------+
 | difference_in_score | 
 +---------------------+
 | 111                 | 
 +---------------------+
-Explanation
-- student_id 309 has a total score of 88 + 47 + 87 = 222.
-- student_id 321 has a total score of 98 + 95 + 37 = 230.
-- student_id 338 has a total score of 100 + 64 + 43 = 207.
-- student_id 423 has a total score of 60 + 44 + 47 = 151.
-- student_id 896 has a total score of 32 + 37 + 50 = 119.
-- student_id 235 has a total score of 31 + 53 + 69 = 153.
-student_id 321 has the highest score of 230, while student_id 896 has the lowest score of 119. Therefore, the difference between them is 111.
+解释
+- student_id 309 的总分为 88 + 47 + 87 = 222。
+- student_id 321 的总分为 98 + 95 + 37 = 230。
+- student_id 338 的总分为 100 + 64 + 43 = 207。
+- student_id 423 的总分为 60 + 44 + 47 = 151。
+- student_id 896 的总分为 32 + 37 + 50 = 119。
+- student_id 235 的总分为 31 + 53 + 69 = 153。
+student_id 321 的最高分为 230,而 student_id 896 的最低分为 119。因此,它们之间的差异为 111。
 
## 解法 diff --git a/solution/2900-2999/2990.Loan Types/README.md b/solution/2900-2999/2990.Loan Types/README.md index 6e1a3eb18a5ec..a014c01a8a7fa 100644 --- a/solution/2900-2999/2990.Loan Types/README.md +++ b/solution/2900-2999/2990.Loan Types/README.md @@ -1,4 +1,4 @@ -# [2990. Loan Types](https://leetcode.cn/problems/loan-types) +# [2990. 贷款类型](https://leetcode.cn/problems/loan-types) [English Version](/solution/2900-2999/2990.Loan%20Types/README_EN.md) @@ -6,7 +6,7 @@ -

Table: Loans

+

表: Loans

 +-------------+---------+
@@ -16,21 +16,22 @@
 | user_id     | int     |
 | loan_type   | varchar |
 +-------------+---------+
-loan_id is column of unique values for this table.
-This table contains loan_id, user_id, and loan_type.
+loan_id 是这张表具有唯一值的列。
+该表包含 loan_id, user_id,和 loan_type。
 
-

Write a solution to find all distinct user_id's that have at least one Refinance loan type and at least one Mortgage loan type.

+

编写一个查询,找到所有至少有一种 Refinance 贷款类型和至少有一种 Mortgage 贷款类型的 不同 user_id

-

Return the result table ordered by user_id in ascending order.

+

升序 返回结果表中的 user_id

-

The result format is in the following example.

+

返回结果表格式如下例所示。

 

-

Example 1:

+ +

示例 1:

-Input:
+输入:
 Sessions table:
 +---------+---------+-----------+
 | loan_id | user_id | loan_type |
@@ -44,18 +45,18 @@ Sessions table:
 | 308     | 103     | Refinance |
 | 389     | 104     | Mortgage  |
 +---------+---------+-----------+
-Output
+输出
 +---------+
 | user_id | 
 +---------+
 | 102     | 
 +---------+
-Explanation
-- User_id 101 has three loan types, one of which is a Mortgage. However, this user does not have any loan type categorized as Refinance, so user_id 101 won't be considered.
-- User_id 102 possesses three loan types: one for Mortgage and one for Refinance. Hence, user_id 102 will be included in the result.
-- User_id 103 has a loan type of Refinance but lacks a Mortgage loan type, so user_id 103 won't be considered.
-- User_id 104 has a Mortgage loan type but doesn't have a Refinance loan type, thus, user_id 104 won't be considered.
-Output table is ordered by user_id in ascending order.
+解释
+- User_id 101 有三种贷款类型,其中之一是 Mortgage。但是,此用户没有任何类别为 Refinance 的贷款类型,因此用户 101 不会被考虑。
+- User_id 102 拥有三种贷款类型:一种是 Mortgage,一种是 Refinance。因此,用户 102 将包括在结果中。
+- User_id 103 有一种 Refinance 贷款类型,但没有 Mortgage 贷款类型,因此用户 103 不会被考虑。
+- User_id 104 有一种 Mortgage 贷款类型,但没有 Refinance 贷款类型,因此用户 104 不会被考虑。
+输出表以升序按 user_id 排序。
 
## 解法 diff --git a/solution/DATABASE_README.md b/solution/DATABASE_README.md index 9c8b9dad27d81..7a6f535f04216 100644 --- a/solution/DATABASE_README.md +++ b/solution/DATABASE_README.md @@ -253,8 +253,8 @@ | 2986 | [Find Third Transaction](/solution/2900-2999/2986.Find%20Third%20Transaction/README.md) | | 中等 | 🔒 | | 2987 | [Find Expensive Cities](/solution/2900-2999/2987.Find%20Expensive%20Cities/README.md) | | 简单 | 🔒 | | 2988 | [Manager of the Largest Department](/solution/2900-2999/2988.Manager%20of%20the%20Largest%20Department/README.md) | | 中等 | 🔒 | -| 2989 | [Class Performance](/solution/2900-2999/2989.Class%20Performance/README.md) | | 中等 | 🔒 | -| 2990 | [Loan Types](/solution/2900-2999/2990.Loan%20Types/README.md) | | 简单 | 🔒 | +| 2989 | [班级表现](/solution/2900-2999/2989.Class%20Performance/README.md) | | 中等 | 🔒 | +| 2990 | [贷款类型](/solution/2900-2999/2990.Loan%20Types/README.md) | | 简单 | 🔒 | | 2991 | [Top Three Wineries](/solution/2900-2999/2991.Top%20Three%20Wineries/README.md) | | 困难 | 🔒 | ## 版权 diff --git a/solution/README.md b/solution/README.md index 3bcd639452034..11750f34cfa9a 100644 --- a/solution/README.md +++ b/solution/README.md @@ -16,7 +16,7 @@ | 0003 | [无重复字符的最长子串](/solution/0000-0099/0003.Longest%20Substring%20Without%20Repeating%20Characters/README.md) | `哈希表`,`字符串`,`滑动窗口` | 中等 | | | 0004 | [寻找两个正序数组的中位数](/solution/0000-0099/0004.Median%20of%20Two%20Sorted%20Arrays/README.md) | `数组`,`二分查找`,`分治` | 困难 | | | 0005 | [最长回文子串](/solution/0000-0099/0005.Longest%20Palindromic%20Substring/README.md) | `字符串`,`动态规划` | 中等 | | -| 0006 | [N 字形变换](/solution/0000-0099/0006.Zigzag%20Conversion/README.md) | `字符串` | 中等 | | +| 0006 | [Z 字形变换](/solution/0000-0099/0006.Zigzag%20Conversion/README.md) | `字符串` | 中等 | | | 0007 | [整数反转](/solution/0000-0099/0007.Reverse%20Integer/README.md) | `数学` | 中等 | | | 0008 | [字符串转换整数 (atoi)](/solution/0000-0099/0008.String%20to%20Integer%20%28atoi%29/README.md) | `字符串` | 中等 | | | 0009 | [回文数](/solution/0000-0099/0009.Palindrome%20Number/README.md) | `数学` | 简单 | | @@ -2999,8 +2999,8 @@ | 2986 | [Find Third Transaction](/solution/2900-2999/2986.Find%20Third%20Transaction/README.md) | | 中等 | 🔒 | | 2987 | [Find Expensive Cities](/solution/2900-2999/2987.Find%20Expensive%20Cities/README.md) | | 简单 | 🔒 | | 2988 | [Manager of the Largest Department](/solution/2900-2999/2988.Manager%20of%20the%20Largest%20Department/README.md) | | 中等 | 🔒 | -| 2989 | [Class Performance](/solution/2900-2999/2989.Class%20Performance/README.md) | | 中等 | 🔒 | -| 2990 | [Loan Types](/solution/2900-2999/2990.Loan%20Types/README.md) | | 简单 | 🔒 | +| 2989 | [班级表现](/solution/2900-2999/2989.Class%20Performance/README.md) | | 中等 | 🔒 | +| 2990 | [贷款类型](/solution/2900-2999/2990.Loan%20Types/README.md) | | 简单 | 🔒 | | 2991 | [Top Three Wineries](/solution/2900-2999/2991.Top%20Three%20Wineries/README.md) | | 困难 | 🔒 | ## 版权 diff --git a/solution/database-summary.md b/solution/database-summary.md index 608ea8da88bd0..2c51298656512 100644 --- a/solution/database-summary.md +++ b/solution/database-summary.md @@ -243,6 +243,6 @@ - [2986.Find Third Transaction](/database-solution/2900-2999/2986.Find%20Third%20Transaction/README.md) - [2987.Find Expensive Cities](/database-solution/2900-2999/2987.Find%20Expensive%20Cities/README.md) - [2988.Manager of the Largest Department](/database-solution/2900-2999/2988.Manager%20of%20the%20Largest%20Department/README.md) - - [2989.Class Performance](/database-solution/2900-2999/2989.Class%20Performance/README.md) - - [2990.Loan Types](/database-solution/2900-2999/2990.Loan%20Types/README.md) + - [2989.班级表现](/database-solution/2900-2999/2989.Class%20Performance/README.md) + - [2990.贷款类型](/database-solution/2900-2999/2990.Loan%20Types/README.md) - [2991.Top Three Wineries](/database-solution/2900-2999/2991.Top%20Three%20Wineries/README.md) diff --git a/solution/summary.md b/solution/summary.md index b92ed7777d743..cf349b2aca52f 100644 --- a/solution/summary.md +++ b/solution/summary.md @@ -5,7 +5,7 @@ - [0003.无重复字符的最长子串](/solution/0000-0099/0003.Longest%20Substring%20Without%20Repeating%20Characters/README.md) - [0004.寻找两个正序数组的中位数](/solution/0000-0099/0004.Median%20of%20Two%20Sorted%20Arrays/README.md) - [0005.最长回文子串](/solution/0000-0099/0005.Longest%20Palindromic%20Substring/README.md) - - [0006.N 字形变换](/solution/0000-0099/0006.Zigzag%20Conversion/README.md) + - [0006.Z 字形变换](/solution/0000-0099/0006.Zigzag%20Conversion/README.md) - [0007.整数反转](/solution/0000-0099/0007.Reverse%20Integer/README.md) - [0008.字符串转换整数 (atoi)](/solution/0000-0099/0008.String%20to%20Integer%20%28atoi%29/README.md) - [0009.回文数](/solution/0000-0099/0009.Palindrome%20Number/README.md) @@ -3046,6 +3046,6 @@ - [2986.Find Third Transaction](/solution/2900-2999/2986.Find%20Third%20Transaction/README.md) - [2987.Find Expensive Cities](/solution/2900-2999/2987.Find%20Expensive%20Cities/README.md) - [2988.Manager of the Largest Department](/solution/2900-2999/2988.Manager%20of%20the%20Largest%20Department/README.md) - - [2989.Class Performance](/solution/2900-2999/2989.Class%20Performance/README.md) - - [2990.Loan Types](/solution/2900-2999/2990.Loan%20Types/README.md) + - [2989.班级表现](/solution/2900-2999/2989.Class%20Performance/README.md) + - [2990.贷款类型](/solution/2900-2999/2990.Loan%20Types/README.md) - [2991.Top Three Wineries](/solution/2900-2999/2991.Top%20Three%20Wineries/README.md)