diff --git a/solution/0100-0199/0197.Rising Temperature/README.md b/solution/0100-0199/0197.Rising Temperature/README.md index 7315f44bb7e9b..bd607a10c0d14 100644 --- a/solution/0100-0199/0197.Rising Temperature/README.md +++ b/solution/0100-0199/0197.Rising Temperature/README.md @@ -19,6 +19,7 @@ | temperature | int | +---------------+---------+ id 是该表具有唯一值的列。 +没有具有相同 recordDate 的不同行。 该表包含特定日期的温度信息

 

diff --git a/solution/0100-0199/0197.Rising Temperature/README_EN.md b/solution/0100-0199/0197.Rising Temperature/README_EN.md index 24eb78c0aa349..070c8c88f53b2 100644 --- a/solution/0100-0199/0197.Rising Temperature/README_EN.md +++ b/solution/0100-0199/0197.Rising Temperature/README_EN.md @@ -15,6 +15,7 @@ | temperature | int | +---------------+---------+ id is the column with unique values for this table. +There are no different rows with the same recordDate. This table contains information about the temperature on a certain day. diff --git a/solution/0500-0599/0521.Longest Uncommon Subsequence I/README_EN.md b/solution/0500-0599/0521.Longest Uncommon Subsequence I/README_EN.md index 5afc6330f2779..3ed5479011743 100644 --- a/solution/0500-0599/0521.Longest Uncommon Subsequence I/README_EN.md +++ b/solution/0500-0599/0521.Longest Uncommon Subsequence I/README_EN.md @@ -4,15 +4,9 @@ ## Description -

Given two strings a and b, return the length of the longest uncommon subsequence between a and b. If the longest uncommon subsequence does not exist, return -1.

+

Given two strings a and b, return the length of the longest uncommon subsequence between a and b. If no such uncommon subsequence exists, return -1.

-

An uncommon subsequence between two strings is a string that is a subsequence of one but not the other.

- -

A subsequence of a string s is a string that can be obtained after deleting any number of characters from s.

- - +

An uncommon subsequence between two strings is a string that is a subsequence of exactly one of them.

 

Example 1:

@@ -37,7 +31,7 @@ Note that "cdc" is also a longest uncommon subsequence.
 Input: a = "aaa", b = "aaa"
 Output: -1
-Explanation: Every subsequence of string a is also a subsequence of string b. Similarly, every subsequence of string b is also a subsequence of string a.
+Explanation: Every subsequence of string a is also a subsequence of string b. Similarly, every subsequence of string b is also a subsequence of string a. So the answer would be -1.
 

 

diff --git a/solution/0600-0699/0606.Construct String from Binary Tree/README_EN.md b/solution/0600-0699/0606.Construct String from Binary Tree/README_EN.md index 47494459bb4d1..31924d392da56 100644 --- a/solution/0600-0699/0606.Construct String from Binary Tree/README_EN.md +++ b/solution/0600-0699/0606.Construct String from Binary Tree/README_EN.md @@ -4,25 +4,43 @@ ## Description -

Given the root of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way, and return it.

+

Given the root node of a binary tree, your task is to create a string representation of the tree following a specific set of formatting rules. The representation should be based on a preorder traversal of the binary tree and must adhere to the following guidelines:

-

Omit all the empty parenthesis pairs that do not affect the one-to-one mapping relationship between the string and the original binary tree.

+

 

Example 1:

- +
 Input: root = [1,2,3,4]
 Output: "1(2(4))(3)"
-Explanation: Originally, it needs to be "1(2(4)())(3()())", but you need to omit all the unnecessary empty parenthesis pairs. And it will be "1(2(4))(3)"
+Explanation: Originally, it needs to be "1(2(4)())(3()())", but you need to omit all the empty parenthesis pairs. And it will be "1(2(4))(3)".
 

Example 2:

- +
 Input: root = [1,2,3,null,4]
 Output: "1(2()(4))(3)"
-Explanation: Almost the same as the first example, except we cannot omit the first parenthesis pair to break the one-to-one mapping relationship between the input and the output.
+Explanation: Almost the same as the first example, except the () after 2 is necessary to indicate the absence of a left child for 2 and the presence of a right child.
 

 

diff --git a/solution/0800-0899/0827.Making A Large Island/README.md b/solution/0800-0899/0827.Making A Large Island/README.md index ead89263fb7dc..d7dacf23f4f09 100644 --- a/solution/0800-0899/0827.Making A Large Island/README.md +++ b/solution/0800-0899/0827.Making A Large Island/README.md @@ -6,15 +6,15 @@ -

给你一个大小为 n x n 二进制矩阵 grid最多 只能将一格 0 变成 1

+

给你一个大小为 n x n 二进制矩阵 grid最多 只能将一格 0 变成 1

返回执行此操作后,grid 中最大的岛屿面积是多少?

-

岛屿 由一组上、下、左、右四个方向相连的 1 形成。

+

岛屿 由一组上、下、左、右四个方向相连的 1 形成。

-

 

+

 

-

示例 1:

+

示例 1:

 输入: grid = [[1, 0], [0, 1]]
@@ -22,28 +22,28 @@
 解释: 将一格0变成1,最终连通两个小岛得到面积为 3 的岛屿。
 
-

示例 2:

+

示例 2:

 输入: grid = [[1, 1], [1, 0]]
 输出: 4
 解释: 将一格0变成1,岛屿的面积扩大为 4。
-

示例 3:

+

示例 3:

 输入: grid = [[1, 1], [1, 1]]
 输出: 4
 解释: 没有0可以让我们变成1,面积依然为 4。
-

 

+

 

提示:

diff --git a/solution/1600-1699/1657.Determine if Two Strings Are Close/README.md b/solution/1600-1699/1657.Determine if Two Strings Are Close/README.md index d40983cf100f6..cee2cb18611fe 100644 --- a/solution/1600-1699/1657.Determine if Two Strings Are Close/README.md +++ b/solution/1600-1699/1657.Determine if Two Strings Are Close/README.md @@ -12,12 +12,12 @@
  • 操作 1:交换任意两个 现有 字符。
  • 操作 2:将一个 现有 字符的每次出现转换为另一个 现有 字符,并对另一个字符执行相同的操作。
  • @@ -27,7 +27,7 @@

    给你两个字符串,word1word2 。如果 word1 word2 接近 ,就返回 true ;否则,返回 false

    -

     

    +

     

    示例 1:

    @@ -35,8 +35,8 @@ 输入:word1 = "abc", word2 = "bca" 输出:true 解释:2 次操作从 word1 获得 word2 。 -执行操作 1:"abc" -> "acb" -执行操作 1:"acb" -> "bca" +执行操作 1:"abc" -> "acb" +执行操作 1:"acb" -> "bca"

    示例 2:

    @@ -52,24 +52,15 @@ 输入:word1 = "cabbba", word2 = "abbccc" 输出:true 解释:3 次操作从 word1 获得 word2 。 -执行操作 1:"cabbba" -> "caabbb" -执行操作 2:"caabbb" -> "baaccc" -执行操作 2:"baaccc" -> "abbccc" +执行操作 1:"cabbba" -> "caabbb" +执行操作 2:"caabbb" -> "baaccc" +执行操作 2:"baaccc" -> "abbccc" -

    示例 4:

    - -
    -输入:word1 = "cabbba", word2 = "aabbss"
    -输出:false
    -解释:不管执行多少次操作,都无法从 word1 得到 word2 ,反之亦然。
    - -

     

    -

    提示:

    diff --git a/solution/1600-1699/1657.Determine if Two Strings Are Close/README_EN.md b/solution/1600-1699/1657.Determine if Two Strings Are Close/README_EN.md index 07542498527ee..b1a81b5c47b23 100644 --- a/solution/1600-1699/1657.Determine if Two Strings Are Close/README_EN.md +++ b/solution/1600-1699/1657.Determine if Two Strings Are Close/README_EN.md @@ -51,7 +51,7 @@ Apply Operation 1: "acb" -> "bca&q Output: true Explanation: You can attain word2 from word1 in 3 operations. Apply Operation 1: "cabbba" -> "caabbb" -Apply Operation 2: "caabbb" -> "baaccc" +Apply Operation 2: "caabbb" -> "baaccc" Apply Operation 2: "baaccc" -> "abbccc" diff --git a/solution/2100-2199/2186.Minimum Number of Steps to Make Two Strings Anagram II/README.md b/solution/2100-2199/2186.Minimum Number of Steps to Make Two Strings Anagram II/README.md index dbad9dadd81d1..b33e23459e52d 100644 --- a/solution/2100-2199/2186.Minimum Number of Steps to Make Two Strings Anagram II/README.md +++ b/solution/2100-2199/2186.Minimum Number of Steps to Make Two Strings Anagram II/README.md @@ -1,4 +1,4 @@ -# [2186. 使两字符串互为字母异位词的最少步骤数](https://leetcode.cn/problems/minimum-number-of-steps-to-make-two-strings-anagram-ii) +# [2186. 制造字母异位词的最小步骤数 II](https://leetcode.cn/problems/minimum-number-of-steps-to-make-two-strings-anagram-ii) [English Version](/solution/2100-2199/2186.Minimum%20Number%20of%20Steps%20to%20Make%20Two%20Strings%20Anagram%20II/README_EN.md) diff --git a/solution/2200-2299/2254.Design Video Sharing Platform/README_EN.md b/solution/2200-2299/2254.Design Video Sharing Platform/README_EN.md index ed84a54b8443e..48735ea26dbce 100644 --- a/solution/2200-2299/2254.Design Video Sharing Platform/README_EN.md +++ b/solution/2200-2299/2254.Design Video Sharing Platform/README_EN.md @@ -40,7 +40,7 @@ videoSharingPlatform.remove(0); // Remove the video associated with videoSharingPlatform.upload("789"); // Since the video associated with videoId 0 was deleted, // 0 is the smallest available videoId, so return 0. videoSharingPlatform.watch(1, 0, 5); // The video associated with videoId 1 is "456". - // The video from minute 0 to min(5, 3 - 1) = 2 is "456", so return "453". + // The video from minute 0 to min(5, 3 - 1) = 2 is "456", so return "456". videoSharingPlatform.watch(1, 0, 1); // The video associated with videoId 1 is "456". // The video from minute 0 to min(1, 3 - 1) = 1 is "45", so return "45". videoSharingPlatform.like(1); // Increase the number of likes on the video associated with videoId 1. diff --git a/solution/2600-2699/2654.Minimum Number of Operations to Make All Array Elements Equal to 1/README_EN.md b/solution/2600-2699/2654.Minimum Number of Operations to Make All Array Elements Equal to 1/README_EN.md index 1c4be2b90b609..a3ea54895b131 100644 --- a/solution/2600-2699/2654.Minimum Number of Operations to Make All Array Elements Equal to 1/README_EN.md +++ b/solution/2600-2699/2654.Minimum Number of Operations to Make All Array Elements Equal to 1/README_EN.md @@ -43,11 +43,6 @@
  • 1 <= nums[i] <= 106
  • -

     

    -

    Follow-up:

    - -

    The O(n) time complexity solution works, but could you find an O(1) constant time complexity solution?

    - ## Solutions ### Solution 1 diff --git a/solution/2900-2999/2990.Loan Types/README.md b/solution/2900-2999/2990.Loan Types/README.md index 331f8e4d518fe..6fbb466a78e33 100644 --- a/solution/2900-2999/2990.Loan Types/README.md +++ b/solution/2900-2999/2990.Loan Types/README.md @@ -32,7 +32,7 @@ loan_id 是这张表具有唯一值的列。
     输入:
    -Sessions table:
    +Loans table:
     +---------+---------+-----------+
     | loan_id | user_id | loan_type |
     +---------+---------+-----------+
    diff --git a/solution/2900-2999/2990.Loan Types/README_EN.md b/solution/2900-2999/2990.Loan Types/README_EN.md
    index 7f0c02aa76e80..d1264d1ea20c9 100644
    --- a/solution/2900-2999/2990.Loan Types/README_EN.md	
    +++ b/solution/2900-2999/2990.Loan Types/README_EN.md	
    @@ -29,7 +29,7 @@ This table contains loan_id, user_id, and loan_type.
     
     
     Input:
    -Sessions table:
    +Loans table:
     +---------+---------+-----------+
     | loan_id | user_id | loan_type |
     +---------+---------+-----------+
    diff --git a/solution/3000-3099/3018.Maximum Number of Removal Queries That Can Be Processed I/README.md b/solution/3000-3099/3018.Maximum Number of Removal Queries That Can Be Processed I/README.md
    index 21b6c60f7e4ca..f31c1c75174e1 100644
    --- a/solution/3000-3099/3018.Maximum Number of Removal Queries That Can Be Processed I/README.md	
    +++ b/solution/3000-3099/3018.Maximum Number of Removal Queries That Can Be Processed I/README.md	
    @@ -1,4 +1,4 @@
    -# [3018. Maximum Number of Removal Queries That Can Be Processed I](https://leetcode.cn/problems/maximum-number-of-removal-queries-that-can-be-processed-i)
    +# [3018. 可处理的最大删除操作数 I](https://leetcode.cn/problems/maximum-number-of-removal-queries-that-can-be-processed-i)
     
     [English Version](/solution/3000-3099/3018.Maximum%20Number%20of%20Removal%20Queries%20That%20Can%20Be%20Processed%20I/README_EN.md)
     
    @@ -6,68 +6,70 @@
     
     
     
    -

    You are given a 0-indexed array nums and a 0-indexed array queries.

    +

    给定一个下标 从 0 开始 的数组 nums 和一个下标  0 开始 的数组 queries

    -

    You can do the following operation at the beginning at most once:

    +

    你可以在开始时执行以下操作 最多一次

    -

    We start processing queries in the given order; for each query, we do the following:

    +

    我们以给定的顺序开始处理查询;对于每个查询,我们执行以下操作:

    -

    Return the maximum number of queries that can be processed by doing the operation optimally.

    +

    返回通过以最佳方式执行该操作可以处理的 最大 查询数。

     

    -

    Example 1:

    + +

    示例 1:

    -Input: nums = [1,2,3,4,5], queries = [1,2,3,4,6]
    -Output: 4
    -Explanation: We don't do any operation and process the queries as follows:
    -1- We choose and remove nums[0] since 1 <= 1, then nums becomes [2,3,4,5].
    -2- We choose and remove nums[0] since 2 <= 2, then nums becomes [3,4,5].
    -3- We choose and remove nums[0] since 3 <= 3, then nums becomes [4,5].
    -4- We choose and remove nums[0] since 4 <= 4, then nums becomes [5].
    -5- We can not choose any elements from nums since they are not greater than or equal to 5.
    -Hence, the answer is 4.
    -It can be shown that we can't process more than 4 queries.
    +输入:nums = [1,2,3,4,5], queries = [1,2,3,4,6]
    +输出:4
    +解释:我们不执行任何操作,并按如下方式处理查询:
    +1- 我们选择并移除 nums[0],因为 1 <= 1,那么 nums 就变成 [2,3,4,5]。
    +2- 我们选择并移除 nums[0],因为 2 <= 2,那么 nums 就变成 [3,4,5]。
    +3- 我们选择并移除 nums[0],因为 3 <= 3,那么 nums 就变成 [4,5]。
    +4- 我们选择并移除 nums[0],因为 4 <= 4,那么 nums 就变成 [5]。
    +5- 我们不能从 nums 中选择任何元素,因为它们不大于或等于 5。
    +因此,答案为 4。
    +可以看出,我们不能处理超过 4 个查询。
     
    -

    Example 2:

    +

    示例 2:

    -Input: nums = [2,3,2], queries = [2,2,3]
    -Output: 3
    -Explanation: We don't do any operation and process the queries as follows:
    -1- We choose and remove nums[0] since 2 <= 2, then nums becomes [3,2].
    -2- We choose and remove nums[1] since 2 <= 2, then nums becomes [3].
    -3- We choose and remove nums[0] since 3 <= 3, then nums becomes [].
    -Hence, the answer is 3.
    -It can be shown that we can't process more than 3 queries.
    +输入:nums = [2,3,2], queries = [2,2,3]
    +输出:3
    +解释:我们不做任何操作,按如下方式处理查询:
    +1- 我们选择并移除 nums[0],因为 2 <= 2,那么 nums 就变成 [3,2]。
    +2- 我们选择并移除 nums[1],因为 2 <= 2,那么 nums 就变成 [3]。
    +3- 我们选择并移除 nums[0],因为 3 <= 3,那么 nums 就变成 []。
    +因此,答案为 3。
    +可以看出,我们不能处理超过 3 个查询。
     
    -

    Example 3:

    +

    示例 3:

    -Input: nums = [3,4,3], queries = [4,3,2]
    -Output: 2
    -Explanation: First we replace nums with the subsequence of nums [4,3].
    -Then we can process the queries as follows:
    -1- We choose and remove nums[0] since 4 <= 4, then nums becomes [3].
    -2- We choose and remove nums[0] since 3 <= 3, then nums becomes [].
    -3- We can not process any more queries since nums is empty.
    -Hence, the answer is 2.
    -It can be shown that we can't process more than 2 queries.
    +输入:nums = [3,4,3], queries = [4,3,2]
    +输出:2
    +解释:首先,我们用 nums 的子序列 [4,3] 替换 nums。
    +然后,我们可以按如下方式处理查询:
    +1- 我们选择并移除 nums[0],因为 4 <= 4,那么 nums 就变成 [3]。
    +2- 我们选择并移除 nums[0],因为 3 <= 3,那么 nums 就变成 []。
    +3- 我们无法处理更多查询,因为 nums 为空。
    +因此,答案为 2。
    +可以看出,我们不能处理超过 2 个查询。
     

     

    -

    Constraints:

    + +

    提示: