diff --git a/solution/0000-0099/0080.Remove Duplicates from Sorted Array II/README.md b/solution/0000-0099/0080.Remove Duplicates from Sorted Array II/README.md index ae842e6011937..e0031396abd37 100644 --- a/solution/0000-0099/0080.Remove Duplicates from Sorted Array II/README.md +++ b/solution/0000-0099/0080.Remove Duplicates from Sorted Array II/README.md @@ -46,7 +46,7 @@ for (int i = 0; i < len; i++) {
 输入:nums = [0,0,1,1,1,1,2,3,3]
 输出:7, nums = [0,0,1,1,2,3,3]
-解释:函数应返回新长度 length = 7, 并且原数组的前五个元素被修改为 0, 0, 1, 1, 2, 3, 3。不需要考虑数组中超出新长度后面的元素。
+解释:函数应返回新长度 length = 7, 并且原数组的前七个元素被修改为 0, 0, 1, 1, 2, 3, 3。不需要考虑数组中超出新长度后面的元素。
 

 

diff --git a/solution/0100-0199/0139.Word Break/README.md b/solution/0100-0199/0139.Word Break/README.md index a31e9b0407a0a..09ad1dae37f9f 100644 --- a/solution/0100-0199/0139.Word Break/README.md +++ b/solution/0100-0199/0139.Word Break/README.md @@ -6,7 +6,7 @@ -

给你一个字符串 s 和一个字符串列表 wordDict 作为字典。请你判断是否可以利用字典中出现的单词拼接出 s

+

给你一个字符串 s 和一个字符串列表 wordDict 作为字典。如果可以利用字典中出现的一个或多个单词拼接出 s 则返回 true

注意:不要求字典中出现的单词全部都使用,并且字典中的单词可以重复使用。

diff --git a/solution/0100-0199/0153.Find Minimum in Rotated Sorted Array/README.md b/solution/0100-0199/0153.Find Minimum in Rotated Sorted Array/README.md index 95be27a3a377a..5ae7fec9de74c 100644 --- a/solution/0100-0199/0153.Find Minimum in Rotated Sorted Array/README.md +++ b/solution/0100-0199/0153.Find Minimum in Rotated Sorted Array/README.md @@ -34,7 +34,7 @@
 输入:nums = [4,5,6,7,0,1,2]
 输出:0
-解释:原数组为 [0,1,2,4,5,6,7] ,旋转 4 次得到输入数组。
+解释:原数组为 [0,1,2,4,5,6,7] ,旋转 3 次得到输入数组。
 

示例 3:

diff --git a/solution/0300-0399/0320.Generalized Abbreviation/README.md b/solution/0300-0399/0320.Generalized Abbreviation/README.md index 914b3673a3a68..7b3378273c9d9 100644 --- a/solution/0300-0399/0320.Generalized Abbreviation/README.md +++ b/solution/0300-0399/0320.Generalized Abbreviation/README.md @@ -10,6 +10,7 @@

给你一个字符串 word ,返回 一个由 word所有可能 广义缩写词 组成的列表 。按 任意顺序 返回答案。

diff --git a/solution/0300-0399/0320.Generalized Abbreviation/README_EN.md b/solution/0300-0399/0320.Generalized Abbreviation/README_EN.md index 6ee8f45c4810a..98b25f018bab3 100644 --- a/solution/0300-0399/0320.Generalized Abbreviation/README_EN.md +++ b/solution/0300-0399/0320.Generalized Abbreviation/README_EN.md @@ -8,6 +8,7 @@

Given a string word, return a list of all the possible generalized abbreviations of word. Return the answer in any order.

diff --git a/solution/0300-0399/0375.Guess Number Higher or Lower II/README.md b/solution/0300-0399/0375.Guess Number Higher or Lower II/README.md index 8f309809e1d84..7dee19c0f0c5a 100644 --- a/solution/0300-0399/0375.Guess Number Higher or Lower II/README.md +++ b/solution/0300-0399/0375.Guess Number Higher or Lower II/README.md @@ -27,21 +27,21 @@ 输出:16 解释:制胜策略如下: - 数字范围是 [1,10] 。你先猜测数字为 7 。 -  - 如果这是我选中的数字,你的总费用为 0 。否则,你需要支付 7 。 +  - 如果这是我选中的数字,你的总费用为 $0 。否则,你需要支付 $7 。   - 如果我的数字更大,则下一步需要猜测的数字范围是 [8,10] 。你可以猜测数字为 9 。 -  - 如果这是我选中的数字,你的总费用为 7 。否则,你需要支付 9 。 -  - 如果我的数字更大,那么这个数字一定是 10 。你猜测数字为 10 并赢得游戏,总费用为 7 + 9 = 16 。 -  - 如果我的数字更小,那么这个数字一定是 8 。你猜测数字为 8 并赢得游戏,总费用为 7 + 9 = 16 。 +  - 如果这是我选中的数字,你的总费用为 $7 。否则,你需要支付 $9 。 +  - 如果我的数字更大,那么这个数字一定是 10 。你猜测数字为 10 并赢得游戏,总费用为 $7 + $9 = $16 。 +  - 如果我的数字更小,那么这个数字一定是 8 。你猜测数字为 8 并赢得游戏,总费用为 $7 + $9 = $16 。   - 如果我的数字更小,则下一步需要猜测的数字范围是 [1,6] 。你可以猜测数字为 3 。 -  - 如果这是我选中的数字,你的总费用为 7 。否则,你需要支付 3 。 +  - 如果这是我选中的数字,你的总费用为 $7 。否则,你需要支付 $3 。   - 如果我的数字更大,则下一步需要猜测的数字范围是 [4,6] 。你可以猜测数字为 5 。 -  - 如果这是我选中的数字,你的总费用为 7 + 3 = 10 。否则,你需要支付 5 。 -  - 如果我的数字更大,那么这个数字一定是 6 。你猜测数字为 6 并赢得游戏,总费用为 7 + 3 + 5 = 15 。 -  - 如果我的数字更小,那么这个数字一定是 4 。你猜测数字为 4 并赢得游戏,总费用为 7 + 3 + 5 = 15 。 +  - 如果这是我选中的数字,你的总费用为 $7 + $3 = $10 。否则,你需要支付 $5 。 +  - 如果我的数字更大,那么这个数字一定是 6 。你猜测数字为 6 并赢得游戏,总费用为 $7 + $3 + $5 = $15 。 +  - 如果我的数字更小,那么这个数字一定是 4 。你猜测数字为 4 并赢得游戏,总费用为 $7 + $3 + $5 = $15 。   - 如果我的数字更小,则下一步需要猜测的数字范围是 [1,2] 。你可以猜测数字为 1 。 -  - 如果这是我选中的数字,你的总费用为 7 + 3 = 10 。否则,你需要支付 1 。 -  - 如果我的数字更大,那么这个数字一定是 2 。你猜测数字为 2 并赢得游戏,总费用为 7 + 3 + 1 = 11 。 -在最糟糕的情况下,你需要支付 16 。因此,你只需要 16 就可以确保自己赢得游戏。 +  - 如果这是我选中的数字,你的总费用为 $7 + $3 = $10 。否则,你需要支付 $1 。 +  - 如果我的数字更大,那么这个数字一定是 2 。你猜测数字为 2 并赢得游戏,总费用为 $7 + $3 + $1 = $11 。 +在最糟糕的情况下,你需要支付 $16 。因此,你只需要 $16 就可以确保自己赢得游戏。

示例 2:

@@ -59,9 +59,9 @@ 输出:1 解释:有两个可能的数字 1 和 2 。 - 你可以先猜 1 。 -  - 如果这是我选中的数字,你的总费用为 0 。否则,你需要支付 1 。 -  - 如果我的数字更大,那么这个数字一定是 2 。你猜测数字为 2 并赢得游戏,总费用为 1 。 -最糟糕的情况下,你需要支付 1 。 +  - 如果这是我选中的数字,你的总费用为 $0 。否则,你需要支付 $1 。 +  - 如果我的数字更大,那么这个数字一定是 2 。你猜测数字为 2 并赢得游戏,总费用为 $1 。 +最糟糕的情况下,你需要支付 $1 。

 

diff --git a/solution/0300-0399/0375.Guess Number Higher or Lower II/README_EN.md b/solution/0300-0399/0375.Guess Number Higher or Lower II/README_EN.md index 44f2c81c66fc0..43febb85456f8 100644 --- a/solution/0300-0399/0375.Guess Number Higher or Lower II/README_EN.md +++ b/solution/0300-0399/0375.Guess Number Higher or Lower II/README_EN.md @@ -24,21 +24,21 @@ Output: 16 Explanation: The winning strategy is as follows: - The range is [1,10]. Guess 7. -  - If this is my number, your total is 0. Otherwise, you pay 7. +  - If this is my number, your total is $0. Otherwise, you pay $7.   - If my number is higher, the range is [8,10]. Guess 9. -  - If this is my number, your total is 7. Otherwise, you pay 9. -  - If my number is higher, it must be 10. Guess 10. Your total is 7 + 9 = 16. -  - If my number is lower, it must be 8. Guess 8. Your total is 7 + 9 = 16. +  - If this is my number, your total is $7. Otherwise, you pay $9. +  - If my number is higher, it must be 10. Guess 10. Your total is $7 + $9 = $16. +  - If my number is lower, it must be 8. Guess 8. Your total is $7 + $9 = $16.   - If my number is lower, the range is [1,6]. Guess 3. -  - If this is my number, your total is 7. Otherwise, you pay 3. +  - If this is my number, your total is $7. Otherwise, you pay $3.   - If my number is higher, the range is [4,6]. Guess 5. -  - If this is my number, your total is 7 + 3 = 10. Otherwise, you pay 5. -  - If my number is higher, it must be 6. Guess 6. Your total is 7 + 3 + 5 = 15. -  - If my number is lower, it must be 4. Guess 4. Your total is 7 + 3 + 5 = 15. +  - If this is my number, your total is $7 + $3 = $10. Otherwise, you pay $5. +  - If my number is higher, it must be 6. Guess 6. Your total is $7 + $3 + $5 = $15. +  - If my number is lower, it must be 4. Guess 4. Your total is $7 + $3 + $5 = $15.   - If my number is lower, the range is [1,2]. Guess 1. -  - If this is my number, your total is 7 + 3 = 10. Otherwise, you pay 1. -  - If my number is higher, it must be 2. Guess 2. Your total is 7 + 3 + 1 = 11. -The worst case in all these scenarios is that you pay 16. Hence, you only need 16 to guarantee a win. +  - If this is my number, your total is $7 + $3 = $10. Otherwise, you pay $1. +  - If my number is higher, it must be 2. Guess 2. Your total is $7 + $3 + $1 = $11. +The worst case in all these scenarios is that you pay $16. Hence, you only need $16 to guarantee a win.

Example 2:

@@ -56,9 +56,9 @@ The worst case in all these scenarios is that you pay 16. Hence, you only need 1 Output: 1 Explanation: There are two possible numbers, 1 and 2. - Guess 1. -  - If this is my number, your total is 0. Otherwise, you pay 1. -  - If my number is higher, it must be 2. Guess 2. Your total is 1. -The worst case is that you pay 1. +  - If this is my number, your total is $0. Otherwise, you pay $1. +  - If my number is higher, it must be 2. Guess 2. Your total is $1. +The worst case is that you pay $1.

 

diff --git a/solution/0400-0499/0447.Number of Boomerangs/README.md b/solution/0400-0499/0447.Number of Boomerangs/README.md index 40a5f7ebfad88..f87cfddda226d 100644 --- a/solution/0400-0499/0447.Number of Boomerangs/README.md +++ b/solution/0400-0499/0447.Number of Boomerangs/README.md @@ -6,7 +6,7 @@ -

给定平面上 n 互不相同 的点 points ,其中 points[i] = [xi, yi]回旋镖 是由点 (i, j, k) 表示的元组 ,其中 i 和 j 之间的距离和 i 和 k 之间的欧式距离相等(需要考虑元组的顺序)。

+

给定平面上 n 互不相同 的点 points ,其中 points[i] = [xi, yi]回旋镖 是由点 (i, j, k) 表示的元组 ,其中 i 和 j 之间的欧式距离和 i 和 k 之间的欧式距离相等(需要考虑元组的顺序)。

返回平面上所有回旋镖的数量。

  diff --git a/solution/0400-0499/0465.Optimal Account Balancing/README.md b/solution/0400-0499/0465.Optimal Account Balancing/README.md index c978d3cb80789..e059001f557f4 100644 --- a/solution/0400-0499/0465.Optimal Account Balancing/README.md +++ b/solution/0400-0499/0465.Optimal Account Balancing/README.md @@ -6,7 +6,7 @@ -

给你一个表示交易的数组 transactions ,其中 transactions[i] = [fromi, toi, amounti] 表示 ID = fromi 的人给 ID = toi 的人共计 amounti

+

给你一个表示交易的数组 transactions ,其中 transactions[i] = [fromi, toi, amounti] 表示 ID = fromi 的人给 ID = toi 的人共计 amounti $

请你计算并返回还清所有债务的最小交易笔数。

@@ -18,9 +18,9 @@ 输入:transactions = [[0,1,10],[2,0,5]] 输出:2 解释: -#0 给 #1 10 。 -#2 给 #0 5 。 -需要进行两笔交易。一种结清债务的方式是 #1 给 #0 和 #2 各 5 。 +#0 给 #1 $10 。 +#2 给 #0 $5 。 +需要进行两笔交易。一种结清债务的方式是 #1 给 #0 和 #2 各 $5 。

示例 2:

@@ -28,11 +28,11 @@ 输入:transactions = [[0,1,10],[1,0,1],[1,2,5],[2,0,5]] 输出:1 解释: -#0 给 #1 10 。 -#1 给 #0 1 。 -#1 给 #2 5 。 -#2 给 #0 5 。 -因此,#1 只需要给 #0 4 ,所有的债务即可还清。 +#0 给 #1 $10 。 +#1 给 #0 $1 。 +#1 给 #2 $5 。 +#2 给 #0 $5 。 +因此,#1 只需要给 #0 $4 ,所有的债务即可还清。

 

diff --git a/solution/0400-0499/0465.Optimal Account Balancing/README_EN.md b/solution/0400-0499/0465.Optimal Account Balancing/README_EN.md index a7f757fc4189c..923c4e112d7ec 100644 --- a/solution/0400-0499/0465.Optimal Account Balancing/README_EN.md +++ b/solution/0400-0499/0465.Optimal Account Balancing/README_EN.md @@ -4,7 +4,7 @@ ## Description -

You are given an array of transactions transactions where transactions[i] = [fromi, toi, amounti] indicates that the person with ID = fromi gave amounti to the person with ID = toi.

+

You are given an array of transactions transactions where transactions[i] = [fromi, toi, amounti] indicates that the person with ID = fromi gave amounti $ to the person with ID = toi.

Return the minimum number of transactions required to settle the debt.

@@ -15,9 +15,9 @@ Input: transactions = [[0,1,10],[2,0,5]] Output: 2 Explanation: -Person #0 gave person #1 10. -Person #2 gave person #0 5. -Two transactions are needed. One way to settle the debt is person #1 pays person #0 and #2 5 each. +Person #0 gave person #1 $10. +Person #2 gave person #0 $5. +Two transactions are needed. One way to settle the debt is person #1 pays person #0 and #2 $5 each.

Example 2:

@@ -26,11 +26,11 @@ Two transactions are needed. One way to settle the debt is person #1 pays person Input: transactions = [[0,1,10],[1,0,1],[1,2,5],[2,0,5]] Output: 1 Explanation: -Person #0 gave person #1 10. -Person #1 gave person #0 1. -Person #1 gave person #2 5. -Person #2 gave person #0 5. -Therefore, person #1 only need to give person #0 4, and all debt is settled. +Person #0 gave person #1 $10. +Person #1 gave person #0 $1. +Person #1 gave person #2 $5. +Person #2 gave person #0 $5. +Therefore, person #1 only need to give person #0 $4, and all debt is settled.

 

diff --git a/solution/0500-0599/0549.Binary Tree Longest Consecutive Sequence II/README.md b/solution/0500-0599/0549.Binary Tree Longest Consecutive Sequence II/README.md index 082cc85e8abfd..2c83044edb8b8 100644 --- a/solution/0500-0599/0549.Binary Tree Longest Consecutive Sequence II/README.md +++ b/solution/0500-0599/0549.Binary Tree Longest Consecutive Sequence II/README.md @@ -1,4 +1,4 @@ -# [549. 二叉树中最长的连续序列](https://leetcode.cn/problems/binary-tree-longest-consecutive-sequence-ii) +# [549. 二叉树最长连续序列 II](https://leetcode.cn/problems/binary-tree-longest-consecutive-sequence-ii) [English Version](/solution/0500-0599/0549.Binary%20Tree%20Longest%20Consecutive%20Sequence%20II/README_EN.md) diff --git a/solution/0600-0699/0638.Shopping Offers/README_EN.md b/solution/0600-0699/0638.Shopping Offers/README_EN.md index b401b5e3aa1dd..44c0dc4bd9761 100644 --- a/solution/0600-0699/0638.Shopping Offers/README_EN.md +++ b/solution/0600-0699/0638.Shopping Offers/README_EN.md @@ -18,10 +18,10 @@
 Input: price = [2,5], special = [[3,0,5],[1,2,10]], needs = [3,2]
 Output: 14
-Explanation: There are two kinds of items, A and B. Their prices are 2 and 5 respectively. 
-In special offer 1, you can pay 5 for 3A and 0B
-In special offer 2, you can pay 10 for 1A and 2B. 
-You need to buy 3A and 2B, so you may pay 10 for 1A and 2B (special offer #2), and 4 for 2A.
+Explanation: There are two kinds of items, A and B. Their prices are $2 and $5 respectively. 
+In special offer 1, you can pay $5 for 3A and 0B
+In special offer 2, you can pay $10 for 1A and 2B. 
+You need to buy 3A and 2B, so you may pay $10 for 1A and 2B (special offer #2), and $4 for 2A.
 

Example 2:

@@ -29,10 +29,10 @@ You need to buy 3A and 2B, so you may pay 10 for 1A and 2B (special offer #2), a
 Input: price = [2,3,4], special = [[1,1,0,4],[2,2,1,9]], needs = [1,2,1]
 Output: 11
-Explanation: The price of A is 2, and 3 for B, 4 for C. 
-You may pay 4 for 1A and 1B, and 9 for 2A ,2B and 1C. 
-You need to buy 1A ,2B and 1C, so you may pay 4 for 1A and 1B (special offer #1), and 3 for 1B, 4 for 1C. 
-You cannot add more items, though only 9 for 2A ,2B and 1C.
+Explanation: The price of A is $2, and $3 for B, $4 for C. 
+You may pay $4 for 1A and 1B, and $9 for 2A ,2B and 1C. 
+You need to buy 1A ,2B and 1C, so you may pay $4 for 1A and 1B (special offer #1), and $3 for 1B, $4 for 1C. 
+You cannot add more items, though only $9 for 2A ,2B and 1C.
 

 

diff --git a/solution/0600-0699/0679.24 Game/README.md b/solution/0600-0699/0679.24 Game/README.md index 8d35008eaf38d..eb51f1bb4d639 100644 --- a/solution/0600-0699/0679.24 Game/README.md +++ b/solution/0600-0699/0679.24 Game/README.md @@ -12,6 +12,7 @@ +

如果可以得到这样的表达式,其计算结果为 24 ,则返回 true ,否则返回 false 。

diff --git a/solution/0600-0699/0679.24 Game/README_EN.md b/solution/0600-0699/0679.24 Game/README_EN.md index 912fcee72861f..441482c0f1a29 100644 --- a/solution/0600-0699/0679.24 Game/README_EN.md +++ b/solution/0600-0699/0679.24 Game/README_EN.md @@ -10,6 +10,7 @@ +

Return true if you can get such expression that evaluates to 24, and false otherwise.

diff --git a/solution/0600-0699/0682.Baseball Game/README_EN.md b/solution/0600-0699/0682.Baseball Game/README_EN.md index 0378dc739c13b..111c3d5160012 100644 --- a/solution/0600-0699/0682.Baseball Game/README_EN.md +++ b/solution/0600-0699/0682.Baseball Game/README_EN.md @@ -10,6 +10,7 @@ +

Return the sum of all the scores on the record after applying all the operations.

diff --git a/solution/0700-0799/0753.Cracking the Safe/README_EN.md b/solution/0700-0799/0753.Cracking the Safe/README_EN.md index 682c527424f33..10f62faa347a8 100644 --- a/solution/0700-0799/0753.Cracking the Safe/README_EN.md +++ b/solution/0700-0799/0753.Cracking the Safe/README_EN.md @@ -10,6 +10,7 @@

Return any string of minimum length that will unlock the safe at some point of entering it.

@@ -42,7 +44,7 @@ - "01" is typed in starting from the 1st digit. - "10" is typed in starting from the 3rd digit. - "11" is typed in starting from the 2nd digit. -Thus "01100" will unlock the safe. "01100", "10011", and "11001" would also unlock the safe. +Thus "01100" will unlock the safe. "10011", and "11001" would also unlock the safe.

 

diff --git a/solution/0800-0899/0818.Race Car/README_EN.md b/solution/0800-0899/0818.Race Car/README_EN.md index fa23005bce7c9..41df8140a4888 100644 --- a/solution/0800-0899/0818.Race Car/README_EN.md +++ b/solution/0800-0899/0818.Race Car/README_EN.md @@ -8,6 +8,7 @@

For example, after commands "AAR", your car goes to positions 0 --> 1 --> 3 --> 3, and your speed goes to 1 --> 2 --> 4 --> -1.

diff --git a/solution/0800-0899/0824.Goat Latin/README.md b/solution/0800-0899/0824.Goat Latin/README.md index c4e683e514402..79ad01b5a655a 100644 --- a/solution/0800-0899/0824.Goat Latin/README.md +++ b/solution/0800-0899/0824.Goat Latin/README.md @@ -12,6 +12,7 @@ +

返回将 sentence 转换为山羊拉丁文后的句子。

diff --git a/solution/0800-0899/0824.Goat Latin/README_EN.md b/solution/0800-0899/0824.Goat Latin/README_EN.md index 0f2caad2d1933..9e6fccb33feaa 100644 --- a/solution/0800-0899/0824.Goat Latin/README_EN.md +++ b/solution/0800-0899/0824.Goat Latin/README_EN.md @@ -10,6 +10,7 @@ +

Return the final sentence representing the conversion from sentence to Goat Latin.

diff --git a/solution/0800-0899/0860.Lemonade Change/README_EN.md b/solution/0800-0899/0860.Lemonade Change/README_EN.md index c134066f49bba..92fd26ae78175 100644 --- a/solution/0800-0899/0860.Lemonade Change/README_EN.md +++ b/solution/0800-0899/0860.Lemonade Change/README_EN.md @@ -4,7 +4,7 @@ ## Description -

At a lemonade stand, each lemonade costs 5. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemonade and pay with either a 5, 10, or 20 bill. You must provide the correct change to each customer so that the net transaction is that the customer pays 5.

+

At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must provide the correct change to each customer so that the net transaction is that the customer pays $5.

Note that you do not have any change in hand at first.

@@ -17,9 +17,9 @@ Input: bills = [5,5,5,10,20] Output: true Explanation: -From the first 3 customers, we collect three 5 bills in order. -From the fourth customer, we collect a 10 bill and give back a 5. -From the fifth customer, we give a 10 bill and a 5 bill. +From the first 3 customers, we collect three $5 bills in order. +From the fourth customer, we collect a $10 bill and give back a $5. +From the fifth customer, we give a $10 bill and a $5 bill. Since all customers got correct change, we output true. @@ -29,9 +29,9 @@ Since all customers got correct change, we output true. Input: bills = [5,5,10,10,20] Output: false Explanation: -From the first two customers in order, we collect two 5 bills. -For the next two customers in order, we collect a 10 bill and give back a 5 bill. -For the last customer, we can not give the change of 15 back because we only have two 10 bills. +From the first two customers in order, we collect two $5 bills. +For the next two customers in order, we collect a $10 bill and give back a $5 bill. +For the last customer, we can not give the change of $15 back because we only have two $10 bills. Since not every customer received the correct change, the answer is false. diff --git a/solution/0900-0999/0909.Snakes and Ladders/README.md b/solution/0900-0999/0909.Snakes and Ladders/README.md index 8427632bd9832..fa5f15d4e158f 100644 --- a/solution/0900-0999/0909.Snakes and Ladders/README.md +++ b/solution/0900-0999/0909.Snakes and Ladders/README.md @@ -14,12 +14,14 @@

rc 列的棋盘,按前述方法编号,棋盘格中可能存在 “蛇” 或 “梯子”;如果 board[r][c] != -1,那个蛇或梯子的目的地将会是 board[r][c]。编号为 1n2 的方格上没有蛇或梯子。

diff --git a/solution/0900-0999/0909.Snakes and Ladders/README_EN.md b/solution/0900-0999/0909.Snakes and Ladders/README_EN.md index eaf45f0f55a18..edd3c376f7cac 100644 --- a/solution/0900-0999/0909.Snakes and Ladders/README_EN.md +++ b/solution/0900-0999/0909.Snakes and Ladders/README_EN.md @@ -10,12 +10,14 @@

A board square on row r and column c has a snake or ladder if board[r][c] != -1. The destination of that snake or ladder is board[r][c]. Squares 1 and n2 do not have a snake or ladder.

diff --git a/solution/0900-0999/0930.Binary Subarrays With Sum/README_EN.md b/solution/0900-0999/0930.Binary Subarrays With Sum/README_EN.md index 9d600a0cca0e7..d400200799851 100644 --- a/solution/0900-0999/0930.Binary Subarrays With Sum/README_EN.md +++ b/solution/0900-0999/0930.Binary Subarrays With Sum/README_EN.md @@ -9,45 +9,32 @@

A subarray is a contiguous part of the array.

 

-

Example 1:

-
 Input: nums = [1,0,1,0,1], goal = 2
-
 Output: 4
-
 Explanation: The 4 subarrays are bolded and underlined below:
-
 [1,0,1,0,1]
-
 [1,0,1,0,1]
-
 [1,0,1,0,1]
-
 [1,0,1,0,1]
-
 

Example 2:

-
 Input: nums = [0,0,0,0,0], goal = 0
-
 Output: 15
-
 

 

-

Constraints:

## Solutions diff --git a/solution/0900-0999/0936.Stamping The Sequence/README_EN.md b/solution/0900-0999/0936.Stamping The Sequence/README_EN.md index e739d19170026..f66d34fa805dc 100644 --- a/solution/0900-0999/0936.Stamping The Sequence/README_EN.md +++ b/solution/0900-0999/0936.Stamping The Sequence/README_EN.md @@ -10,12 +10,14 @@

We want to convert s to target using at most 10 * target.length turns.

diff --git a/solution/0900-0999/0972.Equal Rational Numbers/README.md b/solution/0900-0999/0972.Equal Rational Numbers/README.md index f69584265d068..31c761e9a3d71 100644 --- a/solution/0900-0999/0972.Equal Rational Numbers/README.md +++ b/solution/0900-0999/0972.Equal Rational Numbers/README.md @@ -12,6 +12,7 @@ +

十进制展开的重复部分通常在一对圆括号内表示。例如:

diff --git a/solution/0900-0999/0972.Equal Rational Numbers/README_EN.md b/solution/0900-0999/0972.Equal Rational Numbers/README_EN.md index 82b6632855551..42c2d3d91c8ac 100644 --- a/solution/0900-0999/0972.Equal Rational Numbers/README_EN.md +++ b/solution/0900-0999/0972.Equal Rational Numbers/README_EN.md @@ -10,6 +10,7 @@ +

The repeating portion of a decimal expansion is conventionally denoted within a pair of round brackets. For example:

diff --git a/solution/0900-0999/0978.Longest Turbulent Subarray/README.md b/solution/0900-0999/0978.Longest Turbulent Subarray/README.md index ff52e832525d9..ed1fa61338a64 100644 --- a/solution/0900-0999/0978.Longest Turbulent Subarray/README.md +++ b/solution/0900-0999/0978.Longest Turbulent Subarray/README.md @@ -14,6 +14,7 @@

 

diff --git a/solution/0900-0999/0978.Longest Turbulent Subarray/README_EN.md b/solution/0900-0999/0978.Longest Turbulent Subarray/README_EN.md index e650fdf9217ac..013e08728cc7b 100644 --- a/solution/0900-0999/0978.Longest Turbulent Subarray/README_EN.md +++ b/solution/0900-0999/0978.Longest Turbulent Subarray/README_EN.md @@ -12,6 +12,7 @@

 

diff --git a/solution/0900-0999/0983.Minimum Cost For Tickets/README.md b/solution/0900-0999/0983.Minimum Cost For Tickets/README.md index 207580002c7f8..08b9c078be027 100644 --- a/solution/0900-0999/0983.Minimum Cost For Tickets/README.md +++ b/solution/0900-0999/0983.Minimum Cost For Tickets/README.md @@ -29,10 +29,10 @@ 输出:11 解释: 例如,这里有一种购买通行证的方法,可以让你完成你的旅行计划: -在第 1 天,你花了 costs[0] = 2 买了一张为期 1 天的通行证,它将在第 1 天生效。 -在第 3 天,你花了 costs[1] = 7 买了一张为期 7 天的通行证,它将在第 3, 4, ..., 9 天生效。 -在第 20 天,你花了 costs[0] = 2 买了一张为期 1 天的通行证,它将在第 20 天生效。 -你总共花了 11,并完成了你计划的每一天旅行。 +在第 1 天,你花了 costs[0] = $2 买了一张为期 1 天的通行证,它将在第 1 天生效。 +在第 3 天,你花了 costs[1] = $7 买了一张为期 7 天的通行证,它将在第 3, 4, ..., 9 天生效。 +在第 20 天,你花了 costs[0] = $2 买了一张为期 1 天的通行证,它将在第 20 天生效。 +你总共花了 $11,并完成了你计划的每一天旅行。

示例 2:

@@ -42,9 +42,9 @@ 输出:17 解释: 例如,这里有一种购买通行证的方法,可以让你完成你的旅行计划: -在第 1 天,你花了 costs[2] = 15 买了一张为期 30 天的通行证,它将在第 1, 2, ..., 30 天生效。 -在第 31 天,你花了 costs[0] = 2 买了一张为期 1 天的通行证,它将在第 31 天生效。 -你总共花了 17,并完成了你计划的每一天旅行。 +在第 1 天,你花了 costs[2] = $15 买了一张为期 30 天的通行证,它将在第 1, 2, ..., 30 天生效。 +在第 31 天,你花了 costs[0] = $2 买了一张为期 1 天的通行证,它将在第 31 天生效。 +你总共花了 $17,并完成了你计划的每一天旅行。

 

diff --git a/solution/0900-0999/0983.Minimum Cost For Tickets/README_EN.md b/solution/0900-0999/0983.Minimum Cost For Tickets/README_EN.md index e08426c400393..01ea92c16f873 100644 --- a/solution/0900-0999/0983.Minimum Cost For Tickets/README_EN.md +++ b/solution/0900-0999/0983.Minimum Cost For Tickets/README_EN.md @@ -29,10 +29,10 @@ Input: days = [1,4,6,7,8,20], costs = [2,7,15] Output: 11 Explanation: For example, here is one way to buy passes that lets you travel your travel plan: -On day 1, you bought a 1-day pass for costs[0] = 2, which covered day 1. -On day 3, you bought a 7-day pass for costs[1] = 7, which covered days 3, 4, ..., 9. -On day 20, you bought a 1-day pass for costs[0] = 2, which covered day 20. -In total, you spent 11 and covered all the days of your travel. +On day 1, you bought a 1-day pass for costs[0] = $2, which covered day 1. +On day 3, you bought a 7-day pass for costs[1] = $7, which covered days 3, 4, ..., 9. +On day 20, you bought a 1-day pass for costs[0] = $2, which covered day 20. +In total, you spent $11 and covered all the days of your travel.

Example 2:

@@ -41,9 +41,9 @@ In total, you spent 11 and covered all the days of your travel. Input: days = [1,2,3,4,5,6,7,8,9,10,30,31], costs = [2,7,15] Output: 17 Explanation: For example, here is one way to buy passes that lets you travel your travel plan: -On day 1, you bought a 30-day pass for costs[2] = 15 which covered days 1, 2, ..., 30. -On day 31, you bought a 1-day pass for costs[0] = 2 which covered day 31. -In total, you spent 17 and covered all the days of your travel. +On day 1, you bought a 30-day pass for costs[2] = $15 which covered days 1, 2, ..., 30. +On day 31, you bought a 1-day pass for costs[0] = $2 which covered day 31. +In total, you spent $17 and covered all the days of your travel.

 

diff --git a/solution/0900-0999/0994.Rotting Oranges/README.md b/solution/0900-0999/0994.Rotting Oranges/README.md index 3ef2d55ad1cfd..807de0548dcaa 100644 --- a/solution/0900-0999/0994.Rotting Oranges/README.md +++ b/solution/0900-0999/0994.Rotting Oranges/README.md @@ -34,7 +34,7 @@
 输入:grid = [[2,1,1],[0,1,1],[1,0,1]]
 输出:-1
-解释:左下角的橘子(第 2 行, 第 0 列)永远不会腐烂,因为腐烂只会发生在 4 个正向上。
+解释:左下角的橘子(第 2 行, 第 0 列)永远不会腐烂,因为腐烂只会发生在 4 个方向上。
 

示例 3:

diff --git a/solution/1000-1099/1096.Brace Expansion II/README.md b/solution/1000-1099/1096.Brace Expansion II/README.md index dd7fd132ca58e..8406bb89dbbd8 100644 --- a/solution/1000-1099/1096.Brace Expansion II/README.md +++ b/solution/1000-1099/1096.Brace Expansion II/README.md @@ -12,6 +12,7 @@

数组的 偏移量 是数组中任意两个元素之间的 最大差值

diff --git a/solution/1600-1699/1675.Minimize Deviation in Array/README_EN.md b/solution/1600-1699/1675.Minimize Deviation in Array/README_EN.md index 473558e3830e1..475ec55a94004 100644 --- a/solution/1600-1699/1675.Minimize Deviation in Array/README_EN.md +++ b/solution/1600-1699/1675.Minimize Deviation in Array/README_EN.md @@ -10,6 +10,7 @@ +

The deviation of the array is the maximum difference between any two elements in the array.

diff --git a/solution/1700-1799/1702.Maximum Binary String After Change/README.md b/solution/1700-1799/1702.Maximum Binary String After Change/README.md index 4045482998ca4..c551721ac3d77 100644 --- a/solution/1700-1799/1702.Maximum Binary String After Change/README.md +++ b/solution/1700-1799/1702.Maximum Binary String After Change/README.md @@ -10,6 +10,7 @@ +

请你返回执行上述操作任意次以后能得到的 最大二进制字符串 。如果二进制字符串 x 对应的十进制数字大于二进制字符串 y 对应的十进制数字,那么我们称二进制字符串 x 大于二进制字符串 y 

diff --git a/solution/1700-1799/1702.Maximum Binary String After Change/README_EN.md b/solution/1700-1799/1702.Maximum Binary String After Change/README_EN.md index b92c91c101352..623ad1cbc5035 100644 --- a/solution/1700-1799/1702.Maximum Binary String After Change/README_EN.md +++ b/solution/1700-1799/1702.Maximum Binary String After Change/README_EN.md @@ -8,6 +8,7 @@ +

Return the maximum binary string you can obtain after any number of operations. Binary string x is greater than binary string y if x's decimal representation is greater than y's decimal representation.

diff --git a/solution/1700-1799/1717.Maximum Score From Removing Substrings/README.md b/solution/1700-1799/1717.Maximum Score From Removing Substrings/README.md index 185294c7bca79..652a9e43154a5 100644 --- a/solution/1700-1799/1717.Maximum Score From Removing Substrings/README.md +++ b/solution/1700-1799/1717.Maximum Score From Removing Substrings/README.md @@ -10,6 +10,7 @@ +

请返回对 s 字符串执行上面操作若干次能得到的最大得分。

diff --git a/solution/1700-1799/1717.Maximum Score From Removing Substrings/README_EN.md b/solution/1700-1799/1717.Maximum Score From Removing Substrings/README_EN.md index 64d6fbb56bdad..b54152ca31607 100644 --- a/solution/1700-1799/1717.Maximum Score From Removing Substrings/README_EN.md +++ b/solution/1700-1799/1717.Maximum Score From Removing Substrings/README_EN.md @@ -8,6 +8,7 @@ +

Return the maximum points you can gain after applying the above operations on s.

diff --git a/solution/1700-1799/1754.Largest Merge Of Two Strings/README.md b/solution/1700-1799/1754.Largest Merge Of Two Strings/README.md index 8e601e00728bd..9a3003db70ab5 100644 --- a/solution/1700-1799/1754.Largest Merge Of Two Strings/README.md +++ b/solution/1700-1799/1754.Largest Merge Of Two Strings/README.md @@ -10,6 +10,7 @@ +

返回你可以构造的字典序 最大 的合并字符串 merge

diff --git a/solution/1700-1799/1754.Largest Merge Of Two Strings/README_EN.md b/solution/1700-1799/1754.Largest Merge Of Two Strings/README_EN.md index a24db9944a4cd..149c9e68d0c85 100644 --- a/solution/1700-1799/1754.Largest Merge Of Two Strings/README_EN.md +++ b/solution/1700-1799/1754.Largest Merge Of Two Strings/README_EN.md @@ -8,6 +8,7 @@ +

Return the lexicographically largest merge you can construct.

diff --git a/solution/1700-1799/1760.Minimum Limit of Balls in a Bag/README.md b/solution/1700-1799/1760.Minimum Limit of Balls in a Bag/README.md index 6ca14897bfd59..e57fe2fc8cf03 100644 --- a/solution/1700-1799/1760.Minimum Limit of Balls in a Bag/README.md +++ b/solution/1700-1799/1760.Minimum Limit of Balls in a Bag/README.md @@ -12,10 +12,12 @@

你的开销是单个袋子里球数目的 最大值 ,你想要 最小化 开销。

diff --git a/solution/1700-1799/1760.Minimum Limit of Balls in a Bag/README_EN.md b/solution/1700-1799/1760.Minimum Limit of Balls in a Bag/README_EN.md index 18e851029113c..8200c446725ac 100644 --- a/solution/1700-1799/1760.Minimum Limit of Balls in a Bag/README_EN.md +++ b/solution/1700-1799/1760.Minimum Limit of Balls in a Bag/README_EN.md @@ -10,10 +10,12 @@

Your penalty is the maximum number of balls in a bag. You want to minimize your penalty after the operations.

diff --git a/solution/1800-1899/1850.Minimum Adjacent Swaps to Reach the Kth Smallest Number/README.md b/solution/1800-1899/1850.Minimum Adjacent Swaps to Reach the Kth Smallest Number/README.md index 1e76b65b779e6..fd685e96645c8 100644 --- a/solution/1800-1899/1850.Minimum Adjacent Swaps to Reach the Kth Smallest Number/README.md +++ b/solution/1800-1899/1850.Minimum Adjacent Swaps to Reach the Kth Smallest Number/README.md @@ -12,6 +12,7 @@

返回要得到第 k最小妙数 需要对 num 执行的 相邻位数字交换的最小次数

diff --git a/solution/1800-1899/1850.Minimum Adjacent Swaps to Reach the Kth Smallest Number/README_EN.md b/solution/1800-1899/1850.Minimum Adjacent Swaps to Reach the Kth Smallest Number/README_EN.md index 47dc743e24caf..5eda26a3c4531 100644 --- a/solution/1800-1899/1850.Minimum Adjacent Swaps to Reach the Kth Smallest Number/README_EN.md +++ b/solution/1800-1899/1850.Minimum Adjacent Swaps to Reach the Kth Smallest Number/README_EN.md @@ -10,6 +10,7 @@

Return the minimum number of adjacent digit swaps that needs to be applied to num to reach the kth smallest wonderful integer.

diff --git a/solution/1800-1899/1891.Cutting Ribbons/README_EN.md b/solution/1800-1899/1891.Cutting Ribbons/README_EN.md index 8a80091a5c7bb..016829c6b1aca 100644 --- a/solution/1800-1899/1891.Cutting Ribbons/README_EN.md +++ b/solution/1800-1899/1891.Cutting Ribbons/README_EN.md @@ -8,6 +8,7 @@

Your goal is to obtain k ribbons of all the same positive integer length. You are allowed to throw away any excess ribbon as a result of cutting.

diff --git a/solution/1800-1899/1899.Merge Triplets to Form Target Triplet/README.md b/solution/1800-1899/1899.Merge Triplets to Form Target Triplet/README.md index a648265a928e3..d0aafa08dfa0c 100644 --- a/solution/1800-1899/1899.Merge Triplets to Form Target Triplet/README.md +++ b/solution/1800-1899/1899.Merge Triplets to Form Target Triplet/README.md @@ -12,10 +12,12 @@

如果通过以上操作我们可以使得目标 三元组 target 成为 triplets 的一个 元素 ,则返回 true ;否则,返回 false

diff --git a/solution/1800-1899/1899.Merge Triplets to Form Target Triplet/README_EN.md b/solution/1800-1899/1899.Merge Triplets to Form Target Triplet/README_EN.md index 0a5762a79762d..266729cf339a5 100644 --- a/solution/1800-1899/1899.Merge Triplets to Form Target Triplet/README_EN.md +++ b/solution/1800-1899/1899.Merge Triplets to Form Target Triplet/README_EN.md @@ -10,10 +10,12 @@

Return true if it is possible to obtain the target triplet [x, y, z] as an element of triplets, or false otherwise.

diff --git a/solution/1900-1999/1920.Build Array from Permutation/README.md b/solution/1900-1999/1920.Build Array from Permutation/README.md index a09b21c7dff8a..7625b5a85e6e9 100644 --- a/solution/1900-1999/1920.Build Array from Permutation/README.md +++ b/solution/1900-1999/1920.Build Array from Permutation/README.md @@ -8,13 +8,14 @@

给你一个 从 0 开始的排列 nums下标也从 0 开始)。请你构建一个 同样长度 的数组 ans ,其中,对于每个 i0 <= i < nums.length),都满足 ans[i] = nums[nums[i]] 。返回构建好的数组 ans

-

从 0 开始的排列 nums 是一个由 0 到 nums.length - 10nums.length - 1 也包含在内)的不同整数组成的数组。

+

从 0 开始的排列 nums 是一个由 0 到 nums.length - 10nums.length - 1 也包含在内)的不同整数组成的数组。

-

 

+

 

示例 1:

-
输入:nums = [0,2,1,5,3,4]
+
+输入:nums = [0,2,1,5,3,4]
 输出:[0,1,2,4,5,3]
 解释:数组 ans 构建如下:
 ans = [nums[nums[0]], nums[nums[1]], nums[nums[2]], nums[nums[3]], nums[nums[4]], nums[nums[5]]]
@@ -23,14 +24,15 @@ ans = [nums[nums[0]], nums[nums[1]], nums[nums[2]], nums[nums[3]], nums[nums[4]]
 
 

示例 2:

-
输入:nums = [5,0,1,2,3,4]
+
+输入:nums = [5,0,1,2,3,4]
 输出:[4,5,0,1,2,3]
 解释:数组 ans 构建如下:
 ans = [nums[nums[0]], nums[nums[1]], nums[nums[2]], nums[nums[3]], nums[nums[4]], nums[nums[5]]]
     = [nums[5], nums[0], nums[1], nums[2], nums[3], nums[4]]
     = [4,5,0,1,2,3]
-

 

+

 

提示:

@@ -40,6 +42,10 @@ ans = [nums[nums[0]], nums[nums[1]], nums[nums[2]], nums[nums[3]], nums[nums[4]]
  • nums 中的元素 互不相同
  • +

     

    + +

    进阶:你能在不使用额外空间的情况下解决此问题吗(即 O(1) 内存)?

    + ## 解法 ### 方法一 diff --git a/solution/1900-1999/1928.Minimum Cost to Reach Destination in Time/README_EN.md b/solution/1900-1999/1928.Minimum Cost to Reach Destination in Time/README_EN.md index 9df5e3b1a0cb3..da4fb28a905f9 100644 --- a/solution/1900-1999/1928.Minimum Cost to Reach Destination in Time/README_EN.md +++ b/solution/1900-1999/1928.Minimum Cost to Reach Destination in Time/README_EN.md @@ -20,7 +20,7 @@
     Input: maxTime = 30, edges = [[0,1,10],[1,2,10],[2,5,10],[0,3,1],[3,4,10],[4,5,15]], passingFees = [5,1,2,20,20,3]
     Output: 11
    -Explanation: The path to take is 0 -> 1 -> 2 -> 5, which takes 30 minutes and has 11 worth of passing fees.
    +Explanation: The path to take is 0 -> 1 -> 2 -> 5, which takes 30 minutes and has $11 worth of passing fees.
     

    Example 2:

    @@ -30,7 +30,7 @@
     Input: maxTime = 29, edges = [[0,1,10],[1,2,10],[2,5,10],[0,3,1],[3,4,10],[4,5,15]], passingFees = [5,1,2,20,20,3]
     Output: 48
    -Explanation: The path to take is 0 -> 3 -> 4 -> 5, which takes 26 minutes and has 48 worth of passing fees.
    +Explanation: The path to take is 0 -> 3 -> 4 -> 5, which takes 26 minutes and has $48 worth of passing fees.
     You cannot take path 0 -> 1 -> 2 -> 5 since it would take too long.
     
    diff --git a/solution/1900-1999/1994.The Number of Good Subsets/README.md b/solution/1900-1999/1994.The Number of Good Subsets/README.md index e57a40e2fe36d..aa038633cd294 100644 --- a/solution/1900-1999/1994.The Number of Good Subsets/README.md +++ b/solution/1900-1999/1994.The Number of Good Subsets/README.md @@ -10,11 +10,13 @@
    • 比方说,如果 nums = [1, 2, 3, 4] : +
      • [2, 3] ,[1, 2, 3] 和 [1, 3] 是  子集,乘积分别为 6 = 2*3 ,6 = 2*3 和 3 = 3 。
      • [1, 4] 和 [4] 不是  子集,因为乘积分别为 4 = 2*2 和 4 = 2*2 。
    • +

    请你返回 nums 中不同的  子集的数目对 109 + 7 取余 的结果。

    diff --git a/solution/1900-1999/1994.The Number of Good Subsets/README_EN.md b/solution/1900-1999/1994.The Number of Good Subsets/README_EN.md index 5fbfb6d8cbcba..6a19f77195288 100644 --- a/solution/1900-1999/1994.The Number of Good Subsets/README_EN.md +++ b/solution/1900-1999/1994.The Number of Good Subsets/README_EN.md @@ -8,11 +8,13 @@
    • For example, if nums = [1, 2, 3, 4]: +
      • [2, 3], [1, 2, 3], and [1, 3] are good subsets with products 6 = 2*3, 6 = 2*3, and 3 = 3 respectively.
      • [1, 4] and [4] are not good subsets with products 4 = 2*2 and 4 = 2*2 respectively.
    • +

    Return the number of different good subsets in nums modulo 109 + 7.

    diff --git a/solution/2000-2099/2004.The Number of Seniors and Juniors to Join the Company/README_EN.md b/solution/2000-2099/2004.The Number of Seniors and Juniors to Join the Company/README_EN.md index eee2d8b9a0ddf..cad99a6dfae43 100644 --- a/solution/2000-2099/2004.The Number of Seniors and Juniors to Join the Company/README_EN.md +++ b/solution/2000-2099/2004.The Number of Seniors and Juniors to Join the Company/README_EN.md @@ -14,25 +14,25 @@ | experience | enum | | salary | int | +-------------+------+ -employee_id is the primary key column for this table. -experience is an enum with one of the values ('Senior', 'Junior'). +employee_id is the column with unique values for this table. +experience is an ENUM (category) type of values ('Senior', 'Junior'). Each row of this table indicates the id of a candidate, their monthly salary, and their experience.

     

    -

    A company wants to hire new employees. The budget of the company for the salaries is 70000. The company's criteria for hiring are:

    +

    A company wants to hire new employees. The budget of the company for the salaries is $70000. The company's criteria for hiring are:

    1. Hiring the largest number of seniors.
    2. After hiring the maximum number of seniors, use the remaining budget to hire the largest number of juniors.
    -

    Write an SQL query to find the number of seniors and juniors hired under the mentioned criteria.

    +

    Write a solution to find the number of seniors and juniors hired under the mentioned criteria.

    Return the result table in any order.

    -

    The query result format is in the following example.

    +

    The result format is in the following example.

     

    Example 1:

    @@ -58,8 +58,8 @@ Candidates table: | Junior | 2 | +------------+---------------------+ Explanation: -We can hire 2 seniors with IDs (2, 11). Since the budget is 70000 and the sum of their salaries is 40000, we still have 30000 but they are not enough to hire the senior candidate with ID 13. -We can hire 2 juniors with IDs (1, 9). Since the remaining budget is 30000 and the sum of their salaries is 20000, we still have 10000 but they are not enough to hire the junior candidate with ID 4. +We can hire 2 seniors with IDs (2, 11). Since the budget is $70000 and the sum of their salaries is $40000, we still have $30000 but they are not enough to hire the senior candidate with ID 13. +We can hire 2 juniors with IDs (1, 9). Since the remaining budget is $30000 and the sum of their salaries is $20000, we still have $10000 but they are not enough to hire the junior candidate with ID 4.

    Example 2:

    @@ -85,7 +85,7 @@ Candidates table: | Junior | 3 | +------------+---------------------+ Explanation: -We cannot hire any seniors with the current budget as we need at least 80000 to hire one senior. +We cannot hire any seniors with the current budget as we need at least $80000 to hire one senior. We can hire all three juniors with the remaining budget.
    diff --git a/solution/2000-2099/2010.The Number of Seniors and Juniors to Join the Company II/README.md b/solution/2000-2099/2010.The Number of Seniors and Juniors to Join the Company II/README.md index 3fa27e830a398..d46293bb4b8bc 100644 --- a/solution/2000-2099/2010.The Number of Seniors and Juniors to Join the Company II/README.md +++ b/solution/2000-2099/2010.The Number of Seniors and Juniors to Join the Company II/README.md @@ -23,7 +23,7 @@ employee_id 是该表中具有唯一值的列。

     

    -

    一家公司想雇佣新员工。公司的工资预算是 70000 。公司的招聘标准是:

    +

    一家公司想雇佣新员工。公司的工资预算是 $70000 。公司的招聘标准是:

    1. 继续雇佣薪水最低的高级职员,直到你不能再雇佣更多的高级职员。
    2. diff --git a/solution/2000-2099/2010.The Number of Seniors and Juniors to Join the Company II/README_EN.md b/solution/2000-2099/2010.The Number of Seniors and Juniors to Join the Company II/README_EN.md index 805240ceca2b4..ecc082a8ba36a 100644 --- a/solution/2000-2099/2010.The Number of Seniors and Juniors to Join the Company II/README_EN.md +++ b/solution/2000-2099/2010.The Number of Seniors and Juniors to Join the Company II/README_EN.md @@ -21,7 +21,7 @@ The salary of each candidate is guaranteed to be unique.

       

      -

      A company wants to hire new employees. The budget of the company for the salaries is 70000. The company's criteria for hiring are:

      +

      A company wants to hire new employees. The budget of the company for the salaries is $70000. The company's criteria for hiring are:

      1. Keep hiring the senior with the smallest salary until you cannot hire any more seniors.
      2. diff --git a/solution/2000-2099/2015.Average Height of Buildings in Each Segment/README.md b/solution/2000-2099/2015.Average Height of Buildings in Each Segment/README.md index 1f207a0196f21..cfc2d25194e37 100644 --- a/solution/2000-2099/2015.Average Height of Buildings in Each Segment/README.md +++ b/solution/2000-2099/2015.Average Height of Buildings in Each Segment/README.md @@ -11,12 +11,14 @@

        给定 buildings ,返回如上所述的二维整数矩阵 street 不包括 街道上没有建筑物的任何区域)。您可以按 任何顺序 返回数组。
        diff --git a/solution/2000-2099/2015.Average Height of Buildings in Each Segment/README_EN.md b/solution/2000-2099/2015.Average Height of Buildings in Each Segment/README_EN.md index 98f2494642974..077abda823b06 100644 --- a/solution/2000-2099/2015.Average Height of Buildings in Each Segment/README_EN.md +++ b/solution/2000-2099/2015.Average Height of Buildings in Each Segment/README_EN.md @@ -10,12 +10,14 @@

        Given buildings, return the 2D integer array street as described above (excluding any areas of the street where there are no buldings). You may return the array in any order.

        diff --git a/solution/2000-2099/2043.Simple Bank System/README.md b/solution/2000-2099/2043.Simple Bank System/README.md index 0038e8032a91d..cb1de59e65358 100644 --- a/solution/2000-2099/2043.Simple Bank System/README.md +++ b/solution/2000-2099/2043.Simple Bank System/README.md @@ -37,14 +37,14 @@ 解释: Bank bank = new Bank([10, 100, 20, 50, 30]); -bank.withdraw(3, 10); // 返回 true ,账户 3 的余额是 20 ,所以可以取款 10 。 - // 账户 3 余额为 20 - 10 = 10 。 -bank.transfer(5, 1, 20); // 返回 true ,账户 5 的余额是 30 ,所以可以转账 20 。 - // 账户 5 的余额为 30 - 20 = 10 ,账户 1 的余额为 10 + 20 = 30 。 -bank.deposit(5, 20); // 返回 true ,可以向账户 5 存款 20 。 - // 账户 5 的余额为 10 + 20 = 30 。 -bank.transfer(3, 4, 15); // 返回 false ,账户 3 的当前余额是 10 。 - // 所以无法转账 15 。 +bank.withdraw(3, 10); // 返回 true ,账户 3 的余额是 $20 ,所以可以取款 $10 。 + // 账户 3 余额为 $20 - $10 = $10 。 +bank.transfer(5, 1, 20); // 返回 true ,账户 5 的余额是 $30 ,所以可以转账 $20 。 + // 账户 5 的余额为 $30 - $20 = $10 ,账户 1 的余额为 $10 + $20 = $30 。 +bank.deposit(5, 20); // 返回 true ,可以向账户 5 存款 $20 。 + // 账户 5 的余额为 $10 + $20 = $30 。 +bank.transfer(3, 4, 15); // 返回 false ,账户 3 的当前余额是 $10 。 + // 所以无法转账 $15 。 bank.withdraw(10, 50); // 返回 false ,交易无效,因为账户 10 并不存在。 diff --git a/solution/2000-2099/2043.Simple Bank System/README_EN.md b/solution/2000-2099/2043.Simple Bank System/README_EN.md index 8110d051abe74..6ae34d512fd84 100644 --- a/solution/2000-2099/2043.Simple Bank System/README_EN.md +++ b/solution/2000-2099/2043.Simple Bank System/README_EN.md @@ -34,14 +34,14 @@ Explanation Bank bank = new Bank([10, 100, 20, 50, 30]); -bank.withdraw(3, 10); // return true, account 3 has a balance of 20, so it is valid to withdraw 10. - // Account 3 has 20 - 10 = 10. -bank.transfer(5, 1, 20); // return true, account 5 has a balance of 30, so it is valid to transfer 20. - // Account 5 has 30 - 20 = 10, and account 1 has 10 + 20 = 30. -bank.deposit(5, 20); // return true, it is valid to deposit 20 to account 5. - // Account 5 has 10 + 20 = 30. -bank.transfer(3, 4, 15); // return false, the current balance of account 3 is 10, - // so it is invalid to transfer 15 from it. +bank.withdraw(3, 10); // return true, account 3 has a balance of $20, so it is valid to withdraw $10. + // Account 3 has $20 - $10 = $10. +bank.transfer(5, 1, 20); // return true, account 5 has a balance of $30, so it is valid to transfer $20. + // Account 5 has $30 - $20 = $10, and account 1 has $10 + $20 = $30. +bank.deposit(5, 20); // return true, it is valid to deposit $20 to account 5. + // Account 5 has $10 + $20 = $30. +bank.transfer(3, 4, 15); // return false, the current balance of account 3 is $10, + // so it is invalid to transfer $15 from it. bank.withdraw(10, 50); // return false, it is invalid because account 10 does not exist. diff --git a/solution/2100-2199/2111.Minimum Operations to Make the Array K-Increasing/README.md b/solution/2100-2199/2111.Minimum Operations to Make the Array K-Increasing/README.md index 531377cb5cae7..50594ef3615af 100644 --- a/solution/2100-2199/2111.Minimum Operations to Make the Array K-Increasing/README.md +++ b/solution/2100-2199/2111.Minimum Operations to Make the Array K-Increasing/README.md @@ -12,6 +12,7 @@

        每一次 操作 中,你可以选择一个下标 i 并将 arr[i] 改成任意 正整数。

        diff --git a/solution/2100-2199/2111.Minimum Operations to Make the Array K-Increasing/README_EN.md b/solution/2100-2199/2111.Minimum Operations to Make the Array K-Increasing/README_EN.md index dd3dc6c6c14b5..2d3b77258d29b 100644 --- a/solution/2100-2199/2111.Minimum Operations to Make the Array K-Increasing/README_EN.md +++ b/solution/2100-2199/2111.Minimum Operations to Make the Array K-Increasing/README_EN.md @@ -10,6 +10,7 @@

        In one operation, you can choose an index i and change arr[i] into any positive integer.

        diff --git a/solution/2100-2199/2117.Abbreviating the Product of a Range/README.md b/solution/2100-2199/2117.Abbreviating the Product of a Range/README.md index b2284620828f5..1bea853e1c93b 100644 --- a/solution/2100-2199/2117.Abbreviating the Product of a Range/README.md +++ b/solution/2100-2199/2117.Abbreviating the Product of a Range/README.md @@ -12,6 +12,7 @@
        1. 统计乘积中 后缀 0 的数目,并 移除 这些 0 ,将这个数目记为 C 。 +
          • 比方说,1000 中有 3 个后缀 0 ,546 中没有后缀 0 。
          @@ -26,6 +27,7 @@
        2. 比方说,12345678987600000 被表示为 "12345...89876e5" 。
        3. +

        请你返回一个字符串,表示 闭区间 [left, right] 中所有整数 乘积 的 缩写 。

        diff --git a/solution/2100-2199/2117.Abbreviating the Product of a Range/README_EN.md b/solution/2100-2199/2117.Abbreviating the Product of a Range/README_EN.md index fa95f4ee07880..ac55299629132 100644 --- a/solution/2100-2199/2117.Abbreviating the Product of a Range/README_EN.md +++ b/solution/2100-2199/2117.Abbreviating the Product of a Range/README_EN.md @@ -10,6 +10,7 @@
        1. Count all trailing zeros in the product and remove them. Let us denote this count as C. +
          • For example, there are 3 trailing zeros in 1000, and there are 0 trailing zeros in 546.
          @@ -24,6 +25,7 @@
        2. For example, 12345678987600000 will be represented as "12345...89876e5".
        3. +

        Return a string denoting the abbreviated product of all integers in the inclusive range [left, right].

        diff --git a/solution/2100-2199/2140.Solving Questions With Brainpower/README.md b/solution/2100-2199/2140.Solving Questions With Brainpower/README.md index 3759601681187..79ecbc4265a6a 100644 --- a/solution/2100-2199/2140.Solving Questions With Brainpower/README.md +++ b/solution/2100-2199/2140.Solving Questions With Brainpower/README.md @@ -12,6 +12,7 @@

      返回重排 nums 的值之后形成的数组。

      diff --git a/solution/2100-2199/2164.Sort Even and Odd Indices Independently/README_EN.md b/solution/2100-2199/2164.Sort Even and Odd Indices Independently/README_EN.md index 853e5cc72fde4..3d5b8a1885df0 100644 --- a/solution/2100-2199/2164.Sort Even and Odd Indices Independently/README_EN.md +++ b/solution/2100-2199/2164.Sort Even and Odd Indices Independently/README_EN.md @@ -8,6 +8,7 @@
      1. Sort the values at odd indices of nums in non-increasing order. +
        • For example, if nums = [4,1,2,3] before this step, it becomes [4,3,2,1] after. The values at odd indices 1 and 3 are sorted in non-increasing order.
        @@ -17,6 +18,7 @@
      2. For example, if nums = [4,1,2,3] before this step, it becomes [2,1,4,3] after. The values at even indices 0 and 2 are sorted in non-decreasing order.
      3. +

      Return the array formed after rearranging the values of nums.

      diff --git a/solution/2100-2199/2191.Sort the Jumbled Numbers/README.md b/solution/2100-2199/2191.Sort the Jumbled Numbers/README.md index c2e14679c4b6f..7a253c42b988a 100644 --- a/solution/2100-2199/2191.Sort the Jumbled Numbers/README.md +++ b/solution/2100-2199/2191.Sort the Jumbled Numbers/README.md @@ -23,12 +23,13 @@

      示例 1:

      -
      输入:mapping = [8,9,4,0,2,1,3,5,7,6], nums = [991,338,38]
      +
      +输入:mapping = [8,9,4,0,2,1,3,5,7,6], nums = [991,338,38]
       输出:[338,38,991]
       解释:
       将数字 991 按照如下规则映射:
       1. mapping[9] = 6 ,所有数位 9 都会变成 6 。
      -2. mapping[1] = 9 ,所有数位 1 都会变成 8 。
      +2. mapping[1] = 9 ,所有数位 1 都会变成 9 。
       所以,991 映射的值为 669 。
       338 映射为 007 ,去掉前导 0 后得到 7 。
       38 映射为 07 ,去掉前导 0 后得到 7 。
      @@ -38,7 +39,8 @@
       
       

      示例 2:

      -
      输入:mapping = [0,1,2,3,4,5,6,7,8,9], nums = [789,456,123]
      +
      +输入:mapping = [0,1,2,3,4,5,6,7,8,9], nums = [789,456,123]
       输出:[123,456,789]
       解释:789 映射为 789 ,456 映射为 456 ,123 映射为 123 。所以排序后数组为 [123,456,789] 。
       
      diff --git a/solution/2200-2299/2241.Design an ATM Machine/README.md b/solution/2200-2299/2241.Design an ATM Machine/README.md index 2d81b292a497a..372435a5c9d05 100644 --- a/solution/2200-2299/2241.Design an ATM Machine/README.md +++ b/solution/2200-2299/2241.Design an ATM Machine/README.md @@ -11,16 +11,16 @@

      取款时,机器会优先取 较大 数额的钱。

        -
      • 比方说,你想取 300 ,并且机器里有 2 张 50 的钞票,1 张 100 的钞票和1 张 200 的钞票,那么机器会取出 100 和 200 的钞票。
      • -
      • 但是,如果你想取 600 ,机器里有 3 张 200 的钞票和1 张 500 的钞票,那么取款请求会被拒绝,因为机器会先取出 500 的钞票,然后无法取出剩余的 100 。注意,因为有 500 钞票的存在,机器 不能 取 200 的钞票。
      • +
      • 比方说,你想取 $300 ,并且机器里有 2 张 $50 的钞票,1 张 $100 的钞票和1 张 $200 的钞票,那么机器会取出 $100 和 $200 的钞票。
      • +
      • 但是,如果你想取 $600 ,机器里有 3 张 $200 的钞票和1 张 $500 的钞票,那么取款请求会被拒绝,因为机器会先取出 $500 的钞票,然后无法取出剩余的 $100 。注意,因为有 $500 钞票的存在,机器 不能 取 $200 的钞票。

      请你实现 ATM 类:

      • ATM() 初始化 ATM 对象。
      • -
      • void deposit(int[] banknotesCount) 分别存入 20 ,50100200 和 500 钞票的数目。
      • -
      • int[] withdraw(int amount) 返回一个长度为 5 的数组,分别表示 20 ,50100 ,200 和 500 钞票的数目,并且更新 ATM 机里取款后钞票的剩余数量。如果无法取出指定数额的钱,请返回 [-1] (这种情况下  取出任何钞票)。
      • +
      • void deposit(int[] banknotesCount) 分别存入 $20 ,$50$100$200 和 $500 钞票的数目。
      • +
      • int[] withdraw(int amount) 返回一个长度为 5 的数组,分别表示 $20 ,$50$100 ,$200 和 $500 钞票的数目,并且更新 ATM 机里取款后钞票的剩余数量。如果无法取出指定数额的钱,请返回 [-1] (这种情况下  取出任何钞票)。

       

      @@ -36,13 +36,13 @@ 解释: ATM atm = new ATM(); -atm.deposit([0,0,1,2,1]); // 存入 1 张 100 ,2 张 200 和 1 张 500 的钞票。 -atm.withdraw(600); // 返回 [0,0,1,0,1] 。机器返回 1 张 100 和 1 张 500 的钞票。机器里剩余钞票的数量为 [0,0,0,2,0] 。 -atm.deposit([0,1,0,1,1]); // 存入 1 张 50 ,1 张 200 和 1 张 500 的钞票。 +atm.deposit([0,0,1,2,1]); // 存入 1 张 $100 ,2 张 $200 和 1 张 $500 的钞票。 +atm.withdraw(600); // 返回 [0,0,1,0,1] 。机器返回 1 张 $100 和 1 张 $500 的钞票。机器里剩余钞票的数量为 [0,0,0,2,0] 。 +atm.deposit([0,1,0,1,1]); // 存入 1 张 $50 ,1 张 $200 和 1 张 $500 的钞票。 // 机器中剩余钞票数量为 [0,1,0,3,1] 。 -atm.withdraw(600); // 返回 [-1] 。机器会尝试取出 500 的钞票,然后无法得到剩余的 100 ,所以取款请求会被拒绝。 +atm.withdraw(600); // 返回 [-1] 。机器会尝试取出 $500 的钞票,然后无法得到剩余的 $100 ,所以取款请求会被拒绝。 // 由于请求被拒绝,机器中钞票的数量不会发生改变。 -atm.withdraw(550); // 返回 [0,1,0,0,1] ,机器会返回 1 张 50 的钞票和 1 张 500 的钞票。
      +atm.withdraw(550); // 返回 [0,1,0,0,1] ,机器会返回 1 张 $50 的钞票和 1 张 $500 的钞票。

       

      diff --git a/solution/2200-2299/2241.Design an ATM Machine/README_EN.md b/solution/2200-2299/2241.Design an ATM Machine/README_EN.md index 1cda656acb3e2..ebcd74de5312e 100644 --- a/solution/2200-2299/2241.Design an ATM Machine/README_EN.md +++ b/solution/2200-2299/2241.Design an ATM Machine/README_EN.md @@ -9,16 +9,16 @@

      When withdrawing, the machine prioritizes using banknotes of larger values.

      Implement the ATM class:

       

      @@ -33,20 +33,20 @@ Explanation ATM atm = new ATM(); -atm.deposit([0,0,1,2,1]); // Deposits 1 100 banknote, 2 200 banknotes, - // and 1 500 banknote. -atm.withdraw(600); // Returns [0,0,1,0,1]. The machine uses 1 100 banknote - // and 1 500 banknote. The banknotes left over in the +atm.deposit([0,0,1,2,1]); // Deposits 1 $100 banknote, 2 $200 banknotes, + // and 1 $500 banknote. +atm.withdraw(600); // Returns [0,0,1,0,1]. The machine uses 1 $100 banknote + // and 1 $500 banknote. The banknotes left over in the // machine are [0,0,0,2,0]. -atm.deposit([0,1,0,1,1]); // Deposits 1 50, 200, and 500 banknote. +atm.deposit([0,1,0,1,1]); // Deposits 1 $50, $200, and $500 banknote. // The banknotes in the machine are now [0,1,0,3,1]. -atm.withdraw(600); // Returns [-1]. The machine will try to use a 500 banknote - // and then be unable to complete the remaining 100, +atm.withdraw(600); // Returns [-1]. The machine will try to use a $500 banknote + // and then be unable to complete the remaining $100, // so the withdraw request will be rejected. // Since the request is rejected, the number of banknotes // in the machine is not modified. -atm.withdraw(550); // Returns [0,1,0,0,1]. The machine uses 1 50 banknote - // and 1 500 banknote.
      +atm.withdraw(550); // Returns [0,1,0,0,1]. The machine uses 1 $50 banknote + // and 1 $500 banknote.

       

      Constraints:

      @@ -57,6 +57,7 @@ atm.withdraw(550); // Returns [0,1,0,0,1]. The machine uses 1 50 banknote
    3. 1 <= amount <= 109
    4. At most 5000 calls in total will be made to withdraw and deposit.
    5. At least one call will be made to each function withdraw and deposit.
    6. +
    7. Sum of banknotesCount[i] in all deposits doesn't exceed 109
    8. ## Solutions diff --git a/solution/2200-2299/2288.Apply Discount to Prices/README.md b/solution/2200-2299/2288.Apply Discount to Prices/README.md index cb5dfee3326d7..31e6d9f3fec5d 100644 --- a/solution/2200-2299/2288.Apply Discount to Prices/README.md +++ b/solution/2200-2299/2288.Apply Discount to Prices/README.md @@ -6,10 +6,10 @@ -

      句子 是由若干个单词组成的字符串,单词之间用单个空格分隔,其中每个单词可以包含数字、小写字母、和美元符号 '' 。如果单词的形式为美元符号后跟着一个非负实数,那么这个单词就表示一个 价格

      +

      句子 是由若干个单词组成的字符串,单词之间用单个空格分隔,其中每个单词可以包含数字、小写字母、和美元符号 '$' 。如果单词的形式为美元符号后跟着一个非负实数,那么这个单词就表示一个 价格

      给你一个字符串 sentence 表示一个句子和一个整数 discount 。对于每个表示价格的单词,都在价格的基础上减免 discount% ,并 更新 该单词到句子中。所有更新后的价格应该表示为一个 恰好保留小数点后两位 的数字。

      @@ -23,22 +23,22 @@

      示例 1:

      -输入:sentence = "there are 1 2 and 5 candies in the shop", discount = 50
      -输出:"there are 0.50 1.00 and 5 candies in the shop"
      +输入:sentence = "there are $1 $2 and 5$ candies in the shop", discount = 50
      +输出:"there are $0.50 $1.00 and 5$ candies in the shop"
       解释:
      -表示价格的单词是 "1" 和 "2" 。 
      -- "1" 减免 50% 为 "0.50" ,所以 "1" 替换为 "0.50" 。
      -- "2" 减免 50% 为 "1" ,所以 "1" 替换为 "1.00" 。
      +表示价格的单词是 "$1" 和 "$2" 。 +- "$1" 减免 50% 为 "$0.50" ,所以 "$1" 替换为 "$0.50" 。 +- "$2" 减免 50% 为 "$1" ,所以 "$1" 替换为 "$1.00" 。

      示例 2:

      -输入:sentence = "1 2 3 4 5 6 7 8 9 10", discount = 100
      -输出:"1 2 0.00 4 0.00 0.00 7 8 0.00 10"
      +输入:sentence = "1 2 $3 4 $5 $6 7 8$ $9 $10$", discount = 100
      +输出:"1 2 $0.00 4 $0.00 $0.00 7 8$ $0.00 $10$"
       解释:
       任何价格减免 100% 都会得到 0 。
      -表示价格的单词分别是 "3"、"5"、"6" 和 "9"。
      -每个单词都替换为 "0.00"。
      +表示价格的单词分别是 "$3"、"$5"、"$6" 和 "$9"。
      +每个单词都替换为 "$0.00"。
       

       

      @@ -47,7 +47,7 @@