diff --git a/solution/0000-0099/0063.Unique Paths II/README.md b/solution/0000-0099/0063.Unique Paths II/README.md index bd6743990bcb9..f770bea10abac 100644 --- a/solution/0000-0099/0063.Unique Paths II/README.md +++ b/solution/0000-0099/0063.Unique Paths II/README.md @@ -18,13 +18,13 @@ tags: -

一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为 “Start” )。

+

给定一个 m x n 的整数数组 grid。一个机器人初始位于 左上角(即 grid[0][0])。机器人尝试移动到 右下角(即 grid[m - 1][n - 1])。机器人每次只能向下或者向右移动一步。

-

机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为 “Finish”)。

+

网格中的障碍物和空位置分别用 10 来表示。机器人的移动路径中不能包含 任何 有障碍物的方格。

-

现在考虑网格中有障碍物。那么从左上角到右下角将会有多少条不同的路径?

+

返回机器人能够到达右下角的不同路径数量。

-

网格中的障碍物和空位置分别用 10 来表示。

+

测试用例保证答案小于等于 2 * 109

 

diff --git a/solution/0100-0199/0191.Number of 1 Bits/README.md b/solution/0100-0199/0191.Number of 1 Bits/README.md index 646ac1b15b9a9..c8981ee6b9a56 100644 --- a/solution/0100-0199/0191.Number of 1 Bits/README.md +++ b/solution/0100-0199/0191.Number of 1 Bits/README.md @@ -42,7 +42,7 @@ tags:
 输入:n = 2147483645
 输出:30
-解释:输入的二进制串 11111111111111111111111111111101 中,共有 30 个设置位。
+解释:输入的二进制串 1111111111111111111111111111101 中,共有 30 个设置位。

 

diff --git a/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/README_EN.md b/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/README_EN.md index 2d9746559e7df..6ca291e4cedbc 100644 --- a/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/README_EN.md +++ b/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/README_EN.md @@ -27,24 +27,24 @@ tags:

 

Example 1:

- +
 Input: root = [3,9,20,null,null,15,7]
 Output: [[9],[3,15],[20],[7]]
 

Example 2:

- +
 Input: root = [3,9,8,4,0,1,7]
 Output: [[4],[9],[3,0,1],[8],[7]]
 

Example 3:

- +
-Input: root = [3,9,8,4,0,1,7,null,null,null,2,5]
-Output: [[4],[9,5],[3,0,1],[8,2],[7]]
+Input: root = [1,2,3,4,10,9,11,null,5,null,null,null,null,null,null,null,6]
+Output: [[4],[2,5],[1,10,9,6],[3],[11]]
 

 

diff --git a/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image1.png b/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image1.png new file mode 100644 index 0000000000000..46e4f25ba56b2 Binary files /dev/null and b/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image1.png differ diff --git a/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image2.png b/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image2.png new file mode 100644 index 0000000000000..4eb9ab14b9c60 Binary files /dev/null and b/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image2.png differ diff --git a/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image3.png b/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image3.png new file mode 100644 index 0000000000000..93d9124fb4d40 Binary files /dev/null and b/solution/0300-0399/0314.Binary Tree Vertical Order Traversal/images/image3.png differ diff --git a/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/README.md b/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/README.md index c2f6edf1659a8..8470025cbdde7 100644 --- a/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/README.md +++ b/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/README.md @@ -27,7 +27,7 @@ tags:

 

-

+

 

@@ -35,7 +35,7 @@ tags:

或者,您可以遵循 LeetCode 的层序遍历序列化格式,其中每组孩子节点由空值分隔。

-

+

例如,上面的树可以序列化为 [1,null,2,3,4,5,null,null,6,7,null,8,null,9,10,null,null,11,null,12,null,13,null,null,14]

diff --git a/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/images/1727093143-BPVnoI-image.png b/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/images/1727093143-BPVnoI-image.png new file mode 100644 index 0000000000000..080c012dce41f Binary files /dev/null and b/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/images/1727093143-BPVnoI-image.png differ diff --git a/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/images/1727093169-WGFOps-image.png b/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/images/1727093169-WGFOps-image.png new file mode 100644 index 0000000000000..1a9d6b07cbb3a Binary files /dev/null and b/solution/0400-0499/0428.Serialize and Deserialize N-ary Tree/images/1727093169-WGFOps-image.png differ diff --git a/solution/0900-0999/0929.Unique Email Addresses/README.md b/solution/0900-0999/0929.Unique Email Addresses/README.md index eb071cac86a03..4f83de7313ac7 100644 --- a/solution/0900-0999/0929.Unique Email Addresses/README.md +++ b/solution/0900-0999/0929.Unique Email Addresses/README.md @@ -67,6 +67,8 @@ tags:
  • 每个 emails[i] 都包含有且仅有一个 '@' 字符
  • 所有本地名和域名都不为空
  • 本地名不会以 '+' 字符作为开头
  • +
  • 域名以 ".com" 后缀结尾。
  • +
  • 域名在 ".com" 后缀前至少包含一个字符
  • diff --git a/solution/0900-0999/0929.Unique Email Addresses/README_EN.md b/solution/0900-0999/0929.Unique Email Addresses/README_EN.md index 98767c5199865..3bbea9e8b3ecf 100644 --- a/solution/0900-0999/0929.Unique Email Addresses/README_EN.md +++ b/solution/0900-0999/0929.Unique Email Addresses/README_EN.md @@ -67,6 +67,7 @@ tags:
  • All local and domain names are non-empty.
  • Local names do not start with a '+' character.
  • Domain names end with the ".com" suffix.
  • +
  • Domain names must contain at least one character before ".com" suffix.
  • diff --git a/solution/1200-1299/1211.Queries Quality and Percentage/README.md b/solution/1200-1299/1211.Queries Quality and Percentage/README.md index c94892bd1498e..5978803d336f5 100644 --- a/solution/1200-1299/1211.Queries Quality and Percentage/README.md +++ b/solution/1200-1299/1211.Queries Quality and Percentage/README.md @@ -41,7 +41,7 @@ tags:

    各查询结果的评分与其位置之间比率的平均值。

    -

    将劣质查询百分比 poor_query_percentage 为:

    +

    将劣质查询百分比 poor_query_percentage 定义为:

    评分小于 3 的查询结果占全部查询结果的百分比。

    diff --git a/solution/1600-1699/1666.Change the Root of a Binary Tree/README.md b/solution/1600-1699/1666.Change the Root of a Binary Tree/README.md index 5649a38b4105f..7cda4054fa74d 100644 --- a/solution/1600-1699/1666.Change the Root of a Binary Tree/README.md +++ b/solution/1600-1699/1666.Change the Root of a Binary Tree/README.md @@ -18,42 +18,44 @@ tags: -

    给定一棵二叉树的根节点 root 和一个叶节点 leaf ,更改二叉树,使得 leaf 为新的根节点。

    +

    给定一棵二叉树的根节点 root 和一个叶节点 leaf ,更改二叉树,使得 leaf 为新的根节点。

    -

    你可以按照下列步骤修改 leaf  root 的路径中除 root 外的每个节点 cur :

    +

    你可以按照下列步骤修改 leaf  root 的路径中除 root 外的每个节点 cur :

      -
    1. 如果 cur 有左子节点,则该子节点变为 cur 的右子节点。注意我们保证 cur 至多有一个子节点。
    2. -
    3. cur 的原父节点变为 cur 的左子节点。
    4. +
    5. 如果 cur 有左子节点,则该子节点变为 cur 的右子节点。注意我们保证 cur 至多有一个子节点。
    6. +
    7. cur 的原父节点变为 cur 的左子节点。

    返回修改后新树的根节点。

    -

    注意:确保你的答案在操作后正确地设定了 Node.parent (父节点)指针,否则会被判为错误答案。

    +

    注意:确保你的答案在操作后正确地设定了 Node.parent (父节点)指针,否则会被判为错误答案。

    -

     

    +

     

    示例 1:

    - -
    输入: root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 7
    +
    +
    +输入: root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 7
     输出: [7,2,null,5,4,3,6,null,null,null,1,null,null,0,8]
     

    示例 2:

    -
    输入: root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 0
    +
    +输入: root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 0
     输出: [0,1,null,3,8,5,null,null,null,6,2,null,null,7,4]
     
    -

     

    +

     

    提示:

      -
    • 树中节点的个数在范围 [2, 100] 内。
    • +
    • 树中节点的个数在范围 [2, 100] 内。
    • -109 <= Node.val <= 109
    • -
    • 所有的 Node.val 都是唯一的。
    • -
    • leaf 存在于树中。
    • +
    • 所有的 Node.val 都是唯一的。
    • +
    • leaf 存在于树中。
    diff --git a/solution/1600-1699/1666.Change the Root of a Binary Tree/README_EN.md b/solution/1600-1699/1666.Change the Root of a Binary Tree/README_EN.md index 9cf85b2f1ad9b..25843aab5c5a1 100644 --- a/solution/1600-1699/1666.Change the Root of a Binary Tree/README_EN.md +++ b/solution/1600-1699/1666.Change the Root of a Binary Tree/README_EN.md @@ -33,7 +33,7 @@ tags:

     

    Example 1:

    - +
     Input: root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 7
     Output: [7,2,null,5,4,3,6,null,null,null,1,null,null,0,8]
    diff --git a/solution/1600-1699/1666.Change the Root of a Binary Tree/images/1727138189-YtDgTf-image.png b/solution/1600-1699/1666.Change the Root of a Binary Tree/images/1727138189-YtDgTf-image.png
    new file mode 100644
    index 0000000000000..3d1a9d119c8d7
    Binary files /dev/null and b/solution/1600-1699/1666.Change the Root of a Binary Tree/images/1727138189-YtDgTf-image.png differ
    diff --git a/solution/1600-1699/1666.Change the Root of a Binary Tree/images/bt_image_1.png b/solution/1600-1699/1666.Change the Root of a Binary Tree/images/bt_image_1.png
    new file mode 100644
    index 0000000000000..f00577bd6814e
    Binary files /dev/null and b/solution/1600-1699/1666.Change the Root of a Binary Tree/images/bt_image_1.png differ
    diff --git a/solution/1600-1699/1666.Change the Root of a Binary Tree/images/fliptree.png b/solution/1600-1699/1666.Change the Root of a Binary Tree/images/fliptree.png
    deleted file mode 100644
    index 4c9ea468f2dae..0000000000000
    Binary files a/solution/1600-1699/1666.Change the Root of a Binary Tree/images/fliptree.png and /dev/null differ
    diff --git a/solution/1800-1899/1858.Longest Word With All Prefixes/README_EN.md b/solution/1800-1899/1858.Longest Word With All Prefixes/README_EN.md
    index 05dd57c29e9c6..c9983247f32f8 100644
    --- a/solution/1800-1899/1858.Longest Word With All Prefixes/README_EN.md	
    +++ b/solution/1800-1899/1858.Longest Word With All Prefixes/README_EN.md	
    @@ -20,63 +20,44 @@ tags:
     

    Given an array of strings words, find the longest string in words such that every prefix of it is also in words.

      - -
    • For example, let words = ["a", "app", "ap"]. The string "app" has prefixes "ap" and "a", all of which are in words.
    • - +
    • For example, let words = ["a", "app", "ap"]. The string "app" has prefixes "ap" and "a", all of which are in words.

    Return the string described above. If there is more than one string with the same length, return the lexicographically smallest one, and if no string exists, return "".

     

    -

    Example 1:

    -
     Input: words = ["k","ki","kir","kira", "kiran"]
    -
     Output: "kiran"
    -
     Explanation: "kiran" has prefixes "kira", "kir", "ki", and "k", and all of them appear in words.
    -
     

    Example 2:

    -
     Input: words = ["a", "banana", "app", "appl", "ap", "apply", "apple"]
    -
     Output: "apple"
    -
     Explanation: Both "apple" and "apply" have all their prefixes in words.
    -
     However, "apple" is lexicographically smaller, so we return that.
    -
     

    Example 3:

    -
     Input: words = ["abc", "bc", "ab", "qwe"]
    -
     Output: ""
    -
     

     

    -

    Constraints:

      - -
    • 1 <= words.length <= 105
    • - -
    • 1 <= words[i].length <= 105
    • - -
    • 1 <= sum(words[i].length) <= 105
    • - +
    • 1 <= words.length <= 105
    • +
    • 1 <= words[i].length <= 105
    • +
    • 1 <= sum(words[i].length) <= 105
    • +
    • words[i] consists only of lowercase English letters.
    diff --git a/solution/2000-2099/2073.Time Needed to Buy Tickets/README.md b/solution/2000-2099/2073.Time Needed to Buy Tickets/README.md index 270790dde6a7e..ab03033cb9a4a 100644 --- a/solution/2000-2099/2073.Time Needed to Buy Tickets/README.md +++ b/solution/2000-2099/2073.Time Needed to Buy Tickets/README.md @@ -32,23 +32,40 @@ tags:

    示例 1:

    -
    输入:tickets = [2,3,2], k = 2
    -输出:6
    -解释: 
    -- 第一轮,队伍中的每个人都买到一张票,队伍变为 [1, 2, 1] 。
    -- 第二轮,队伍中的每个都又都买到一张票,队伍变为 [0, 1, 0] 。
    -位置 2 的人成功买到 2 张票,用掉 3 + 3 = 6 秒。
    -
    +
    输入:tickets = [2,3,2], k = 2
    + +
    输出:6
    + +
    解释:
    + +
     
    + +
      +
    • 队伍一开始为 [2,3,2],第 k 个人以下划线标识。
    • +
    • 在最前面的人买完票后,队伍在第 1 秒变成 [3,2,1]。
    • +
    • 继续这个过程,队伍在第 2 秒变为[2,1,2]。
    • +
    • 继续这个过程,队伍在第 3 秒变为[1,2,1]。
    • +
    • 继续这个过程,队伍在第 4 秒变为[2,1]。
    • +
    • 继续这个过程,队伍在第 5 秒变为[1,1]。
    • +
    • 继续这个过程,队伍在第 6 秒变为[1]。第 k 个人完成买票,所以返回 6。
    • +
    + +
     

    示例 2:

    -
    输入:tickets = [5,1,1,1], k = 0
    -输出:8
    -解释:
    -- 第一轮,队伍中的每个人都买到一张票,队伍变为 [4, 0, 0, 0] 。
    -- 接下来的 4 轮,只有位置 0 的人在买票。
    -位置 0 的人成功买到 5 张票,用掉 4 + 1 + 1 + 1 + 1 = 8 秒。
    -
    +
    输入:tickets = [5,1,1,1], k = 0
    + +
    输出:8
    + +
    解释:
    + +
      +
    • 队伍一开始为 [5,1,1,1],第 k 个人以下划线标识。
    • +
    • 在最前面的人买完票后,队伍在第 1 秒变成 [1,1,1,4]。
    • +
    • 继续这个过程 3 秒,队伍在第 4 秒变为[4]。
    • +
    • 继续这个过程 4 秒,队伍在第 8 秒变为[]。第 k 个人完成买票,所以返回 8。
    • +

     

    diff --git a/solution/2000-2099/2073.Time Needed to Buy Tickets/README_EN.md b/solution/2000-2099/2073.Time Needed to Buy Tickets/README_EN.md index 1a6e414d287fe..dbbf02f284c20 100644 --- a/solution/2000-2099/2073.Time Needed to Buy Tickets/README_EN.md +++ b/solution/2000-2099/2073.Time Needed to Buy Tickets/README_EN.md @@ -26,30 +26,45 @@ tags:

    Each person takes exactly 1 second to buy a ticket. A person can only buy 1 ticket at a time and has to go back to the end of the line (which happens instantaneously) in order to buy more tickets. If a person does not have any tickets left to buy, the person will leave the line.

    -

    Return the time taken for the person at position k (0-indexed) to finish buying tickets.

    +

    Return the time taken for the person initially at position k (0-indexed) to finish buying tickets.

     

    Example 1:

    -
    -Input: tickets = [2,3,2], k = 2
    -Output: 6
    -Explanation: 
    -- In the first pass, everyone in the line buys a ticket and the line becomes [1, 2, 1].
    -- In the second pass, everyone in the line buys a ticket and the line becomes [0, 1, 0].
    -The person at position 2 has successfully bought 2 tickets and it took 3 + 3 = 6 seconds.
    -
    +
    +

    Input: tickets = [2,3,2], k = 2

    + +

    Output: 6

    + +

    Explanation:

    + +
      +
    • The queue starts as [2,3,2], where the kth person is underlined.
    • +
    • After the person at the front has bought a ticket, the queue becomes [3,2,1] at 1 second.
    • +
    • Continuing this process, the queue becomes [2,1,2] at 2 seconds.
    • +
    • Continuing this process, the queue becomes [1,2,1] at 3 seconds.
    • +
    • Continuing this process, the queue becomes [2,1] at 4 seconds. Note: the person at the front left the queue.
    • +
    • Continuing this process, the queue becomes [1,1] at 5 seconds.
    • +
    • Continuing this process, the queue becomes [1] at 6 seconds. The kth person has bought all their tickets, so return 6.
    • +
    +

    Example 2:

    -
    -Input: tickets = [5,1,1,1], k = 0
    -Output: 8
    -Explanation:
    -- In the first pass, everyone in the line buys a ticket and the line becomes [4, 0, 0, 0].
    -- In the next 4 passes, only the person in position 0 is buying tickets.
    -The person at position 0 has successfully bought 5 tickets and it took 4 + 1 + 1 + 1 + 1 = 8 seconds.
    -
    +
    +

    Input: tickets = [5,1,1,1], k = 0

    + +

    Output: 8

    + +

    Explanation:

    + +
      +
    • The queue starts as [5,1,1,1], where the kth person is underlined.
    • +
    • After the person at the front has bought a ticket, the queue becomes [1,1,1,4] at 1 second.
    • +
    • Continuing this process for 3 seconds, the queue becomes [4] at 4 seconds.
    • +
    • Continuing this process for 4 seconds, the queue becomes [] at 8 seconds. The kth person has bought all their tickets, so return 8.
    • +
    +

     

    Constraints:

    diff --git a/solution/2300-2399/2332.The Latest Time to Catch a Bus/README.md b/solution/2300-2399/2332.The Latest Time to Catch a Bus/README.md index 04d884c429f0a..55709f544df1f 100644 --- a/solution/2300-2399/2332.The Latest Time to Catch a Bus/README.md +++ b/solution/2300-2399/2332.The Latest Time to Catch a Bus/README.md @@ -25,7 +25,7 @@ tags:

    给你一个整数 capacity ,表示每辆公交车 最多 能容纳的乘客数目。

    -

    每位乘客都会搭乘下一辆有座位的公交车。如果你在 y 时刻到达,公交在 x 时刻出发,满足 y <= x  且公交没有满,那么你可以搭乘这一辆公交。最早 到达的乘客优先上车。

    +

    每位乘客都会排队搭乘下一辆有座位的公交车。如果你在 y 时刻到达,公交在 x 时刻出发,满足 y <= x  且公交没有满,那么你可以搭乘这一辆公交。最早 到达的乘客优先上车。

    返回你可以搭乘公交车的最晚到达公交站时间。你 不能 跟别的乘客同时刻到达。

    @@ -35,7 +35,8 @@ tags:

    示例 1:

    -
    输入:buses = [10,20], passengers = [2,17,18,19], capacity = 2
    +
    +输入:buses = [10,20], passengers = [2,17,18,19], capacity = 2
     输出:16
     解释:
     第 1 辆公交车载着第 1 位乘客。
    @@ -44,7 +45,8 @@ tags:
     
     

    示例 2:

    -
    输入:buses = [20,30,10], passengers = [19,13,26,4,25,11,21], capacity = 2
    +
    +输入:buses = [20,30,10], passengers = [19,13,26,4,25,11,21], capacity = 2
     输出:20
     解释:
     第 1 辆公交车载着第 4 位乘客。
    diff --git a/solution/2300-2399/2333.Minimum Sum of Squared Difference/README.md b/solution/2300-2399/2333.Minimum Sum of Squared Difference/README.md
    index 0111eaa0fe786..b8e7f03b18d75 100644
    --- a/solution/2300-2399/2333.Minimum Sum of Squared Difference/README.md	
    +++ b/solution/2300-2399/2333.Minimum Sum of Squared Difference/README.md	
    @@ -5,8 +5,9 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/2300-2399/2333.Mi
     rating: 2011
     source: 第 82 场双周赛 Q3
     tags:
    +    - 贪心
         - 数组
    -    - 数学
    +    - 二分查找
         - 排序
         - 堆(优先队列)
     ---
    diff --git a/solution/2300-2399/2333.Minimum Sum of Squared Difference/README_EN.md b/solution/2300-2399/2333.Minimum Sum of Squared Difference/README_EN.md
    index 274360be1b076..bbdb34bc15da1 100644
    --- a/solution/2300-2399/2333.Minimum Sum of Squared Difference/README_EN.md	
    +++ b/solution/2300-2399/2333.Minimum Sum of Squared Difference/README_EN.md	
    @@ -5,8 +5,9 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/2300-2399/2333.Mi
     rating: 2011
     source: Biweekly Contest 82 Q3
     tags:
    +    - Greedy
         - Array
    -    - Math
    +    - Binary Search
         - Sorting
         - Heap (Priority Queue)
     ---
    diff --git a/solution/2300-2399/2336.Smallest Number in Infinite Set/README.md b/solution/2300-2399/2336.Smallest Number in Infinite Set/README.md
    index 63504a6dfc7ab..09264bdc2f005 100644
    --- a/solution/2300-2399/2336.Smallest Number in Infinite Set/README.md	
    +++ b/solution/2300-2399/2336.Smallest Number in Infinite Set/README.md	
    @@ -7,6 +7,7 @@ source: 第 301 场周赛 Q2
     tags:
         - 设计
         - 哈希表
    +    - 有序集合
         - 堆(优先队列)
     ---
     
    diff --git a/solution/2300-2399/2336.Smallest Number in Infinite Set/README_EN.md b/solution/2300-2399/2336.Smallest Number in Infinite Set/README_EN.md
    index dbbe5ddd9f4e3..c047aa8ecf98c 100644
    --- a/solution/2300-2399/2336.Smallest Number in Infinite Set/README_EN.md	
    +++ b/solution/2300-2399/2336.Smallest Number in Infinite Set/README_EN.md	
    @@ -7,6 +7,7 @@ source: Weekly Contest 301 Q2
     tags:
         - Design
         - Hash Table
    +    - Ordered Set
         - Heap (Priority Queue)
     ---
     
    diff --git a/solution/3100-3199/3128.Right Triangles/README.md b/solution/3100-3199/3128.Right Triangles/README.md
    index d105cd34aae93..11ed741a8974d 100644
    --- a/solution/3100-3199/3128.Right Triangles/README.md	
    +++ b/solution/3100-3199/3128.Right Triangles/README.md	
    @@ -24,13 +24,9 @@ tags:
     
     

    给你一个二维 boolean 矩阵 grid 。

    -

    请你返回使用 grid 中的 3 个元素可以构建的 直角三角形 数目,且满足 3 个元素值  为 1 。

    - -

    注意:

    +

    如果 grid 的 3 个元素的集合中,一个元素与另一个元素在 同一行,并且与第三个元素在 同一列,则该集合是一个 直角三角形。3 个元素 不必 彼此相邻。

    -
      -
    • 如果 grid 中 3 个元素满足:一个元素与另一个元素在 同一行,同时与第三个元素在 同一列 ,那么这 3 个元素称为一个 直角三角形 。这 3 个元素互相之间不需要相邻。
    • -
    +

    请你返回使用 grid 中的 3 个元素可以构建的 直角三角形 数目,且满足 3 个元素值  为 1 。

     

    diff --git a/solution/3100-3199/3128.Right Triangles/README_EN.md b/solution/3100-3199/3128.Right Triangles/README_EN.md index ed41f2c70beaf..cf562f0c62aa5 100644 --- a/solution/3100-3199/3128.Right Triangles/README_EN.md +++ b/solution/3100-3199/3128.Right Triangles/README_EN.md @@ -24,13 +24,9 @@ tags:

    You are given a 2D boolean matrix grid.

    -

    Return an integer that is the number of right triangles that can be made with the 3 elements of grid such that all of them have a value of 1.

    +

    A collection of 3 elements of grid is a right triangle if one of its elements is in the same row with another element and in the same column with the third element. The 3 elements may not be next to each other.

    -

    Note:

    - -
      -
    • A collection of 3 elements of grid is a right triangle if one of its elements is in the same row with another element and in the same column with the third element. The 3 elements do not have to be next to each other.
    • -
    +

    Return an integer that is the number of right triangles that can be made with 3 elements of grid such that all of them have a value of 1.

     

    Example 1:

    @@ -39,19 +35,19 @@ tags: - + - + - + - - - + + +
    00 100
    00 1 1
    010010
    @@ -59,19 +55,39 @@ tags: - - - + + + - + - + - + + + +
    010010
    00 1 1
    00 100
    + + + + + + + + + + + + + + + + +
    010
    011
    010
    @@ -84,7 +100,7 @@ tags:

    Explanation:

    -

    There are two right triangles.

    +

    There are two right triangles with elements of the value 1. Notice that the blue ones do not form a right triangle because the 3 elements are in the same column.

    Example 2:

    @@ -93,22 +109,22 @@ tags: - - - - + + + + - - - - + + + + - - - - + + + +
    10001000
    01010101
    10001000
    @@ -121,7 +137,7 @@ tags:

    Explanation:

    -

    There are no right triangles.

    +

    There are no right triangles with elements of the value 1.  Notice that the blue ones do not form a right triangle.

    Example 3:

    @@ -131,18 +147,18 @@ tags: 1 - 0 + 0 1 1 - 0 - 0 + 0 + 0 - 1 - 0 - 0 + 1 + 0 + 0 @@ -151,18 +167,18 @@ tags: 1 - 0 + 0 1 - 1 - 0 - 0 + 1 + 0 + 0 1 - 0 - 0 + 0 + 0 @@ -171,11 +187,11 @@ tags:

    Input: grid = [[1,0,1],[1,0,0],[1,0,0]]

    -

    Output: 2

    +

    Output: 2

    Explanation:

    -

    There are two right triangles.

    +

    There are two right triangles with elements of the value 1.

     

    diff --git a/solution/3200-3299/3271.Hash Divided String/README.md b/solution/3200-3299/3271.Hash Divided String/README.md index a56d69b38c787..4d8c6b7852032 100644 --- a/solution/3200-3299/3271.Hash Divided String/README.md +++ b/solution/3200-3299/3271.Hash Divided String/README.md @@ -27,7 +27,7 @@ tags:
    • 一个字符的 哈希值 是它在 字母表 中的下标(也就是 'a' → 0 ,'b' → 1 ,... ,'z' → 25)。
    • -
    • 将子字符串中字幕的 哈希值 求和。
    • +
    • 将子字符串中字母的 哈希值 求和。
    • 将和对 26 取余,将结果记为 hashedChar 。
    • 找到小写字母表中 hashedChar 对应的字符。
    • 将该字符添加到 result 的末尾。
    • diff --git a/solution/3200-3299/3273.Minimum Amount of Damage Dealt to Bob/README.md b/solution/3200-3299/3273.Minimum Amount of Damage Dealt to Bob/README.md index 9ba6bf2d67e5d..662c5ea95ae0b 100644 --- a/solution/3200-3299/3273.Minimum Amount of Damage Dealt to Bob/README.md +++ b/solution/3200-3299/3273.Minimum Amount of Damage Dealt to Bob/README.md @@ -26,7 +26,7 @@ tags:

      每一秒中,在敌人对 Bob 造成伤害 之后 ,Bob 会选择 一个 还活着的敌人进行攻击,该敌人的健康值减少 power 。

      -

      请你返回 Bob 将 所有 n 个敌人都消灭之前,最少 会收到多少伤害。

      +

      请你返回 Bob 将 所有 n 个敌人都消灭之前,最少 会受到多少伤害。

       

      diff --git a/solution/README.md b/solution/README.md index 78fe9d8fb8acf..679ab18b8899d 100644 --- a/solution/README.md +++ b/solution/README.md @@ -2343,10 +2343,10 @@ | 2330 | [验证回文串 IV](/solution/2300-2399/2330.Valid%20Palindrome%20IV/README.md) | `双指针`,`字符串` | 中等 | 🔒 | | 2331 | [计算布尔二叉树的值](/solution/2300-2399/2331.Evaluate%20Boolean%20Binary%20Tree/README.md) | `树`,`深度优先搜索`,`二叉树` | 简单 | 第 82 场双周赛 | | 2332 | [坐上公交的最晚时间](/solution/2300-2399/2332.The%20Latest%20Time%20to%20Catch%20a%20Bus/README.md) | `数组`,`双指针`,`二分查找`,`排序` | 中等 | 第 82 场双周赛 | -| 2333 | [最小差值平方和](/solution/2300-2399/2333.Minimum%20Sum%20of%20Squared%20Difference/README.md) | `数组`,`数学`,`排序`,`堆(优先队列)` | 中等 | 第 82 场双周赛 | +| 2333 | [最小差值平方和](/solution/2300-2399/2333.Minimum%20Sum%20of%20Squared%20Difference/README.md) | `贪心`,`数组`,`二分查找`,`排序`,`堆(优先队列)` | 中等 | 第 82 场双周赛 | | 2334 | [元素值大于变化阈值的子数组](/solution/2300-2399/2334.Subarray%20With%20Elements%20Greater%20Than%20Varying%20Threshold/README.md) | `栈`,`并查集`,`数组`,`单调栈` | 困难 | 第 82 场双周赛 | | 2335 | [装满杯子需要的最短总时长](/solution/2300-2399/2335.Minimum%20Amount%20of%20Time%20to%20Fill%20Cups/README.md) | `贪心`,`数组`,`排序`,`堆(优先队列)` | 简单 | 第 301 场周赛 | -| 2336 | [无限集中的最小数字](/solution/2300-2399/2336.Smallest%20Number%20in%20Infinite%20Set/README.md) | `设计`,`哈希表`,`堆(优先队列)` | 中等 | 第 301 场周赛 | +| 2336 | [无限集中的最小数字](/solution/2300-2399/2336.Smallest%20Number%20in%20Infinite%20Set/README.md) | `设计`,`哈希表`,`有序集合`,`堆(优先队列)` | 中等 | 第 301 场周赛 | | 2337 | [移动片段得到字符串](/solution/2300-2399/2337.Move%20Pieces%20to%20Obtain%20a%20String/README.md) | `双指针`,`字符串` | 中等 | 第 301 场周赛 | | 2338 | [统计理想数组的数目](/solution/2300-2399/2338.Count%20the%20Number%20of%20Ideal%20Arrays/README.md) | `数学`,`动态规划`,`组合数学`,`数论` | 困难 | 第 301 场周赛 | | 2339 | [联赛的所有比赛](/solution/2300-2399/2339.All%20the%20Matches%20of%20the%20League/README.md) | `数据库` | 简单 | 🔒 | diff --git a/solution/README_EN.md b/solution/README_EN.md index 92a4abf9bf885..188c018c69288 100644 --- a/solution/README_EN.md +++ b/solution/README_EN.md @@ -2341,10 +2341,10 @@ Press Control + F(or Command + F on | 2330 | [Valid Palindrome IV](/solution/2300-2399/2330.Valid%20Palindrome%20IV/README_EN.md) | `Two Pointers`,`String` | Medium | 🔒 | | 2331 | [Evaluate Boolean Binary Tree](/solution/2300-2399/2331.Evaluate%20Boolean%20Binary%20Tree/README_EN.md) | `Tree`,`Depth-First Search`,`Binary Tree` | Easy | Biweekly Contest 82 | | 2332 | [The Latest Time to Catch a Bus](/solution/2300-2399/2332.The%20Latest%20Time%20to%20Catch%20a%20Bus/README_EN.md) | `Array`,`Two Pointers`,`Binary Search`,`Sorting` | Medium | Biweekly Contest 82 | -| 2333 | [Minimum Sum of Squared Difference](/solution/2300-2399/2333.Minimum%20Sum%20of%20Squared%20Difference/README_EN.md) | `Array`,`Math`,`Sorting`,`Heap (Priority Queue)` | Medium | Biweekly Contest 82 | +| 2333 | [Minimum Sum of Squared Difference](/solution/2300-2399/2333.Minimum%20Sum%20of%20Squared%20Difference/README_EN.md) | `Greedy`,`Array`,`Binary Search`,`Sorting`,`Heap (Priority Queue)` | Medium | Biweekly Contest 82 | | 2334 | [Subarray With Elements Greater Than Varying Threshold](/solution/2300-2399/2334.Subarray%20With%20Elements%20Greater%20Than%20Varying%20Threshold/README_EN.md) | `Stack`,`Union Find`,`Array`,`Monotonic Stack` | Hard | Biweekly Contest 82 | | 2335 | [Minimum Amount of Time to Fill Cups](/solution/2300-2399/2335.Minimum%20Amount%20of%20Time%20to%20Fill%20Cups/README_EN.md) | `Greedy`,`Array`,`Sorting`,`Heap (Priority Queue)` | Easy | Weekly Contest 301 | -| 2336 | [Smallest Number in Infinite Set](/solution/2300-2399/2336.Smallest%20Number%20in%20Infinite%20Set/README_EN.md) | `Design`,`Hash Table`,`Heap (Priority Queue)` | Medium | Weekly Contest 301 | +| 2336 | [Smallest Number in Infinite Set](/solution/2300-2399/2336.Smallest%20Number%20in%20Infinite%20Set/README_EN.md) | `Design`,`Hash Table`,`Ordered Set`,`Heap (Priority Queue)` | Medium | Weekly Contest 301 | | 2337 | [Move Pieces to Obtain a String](/solution/2300-2399/2337.Move%20Pieces%20to%20Obtain%20a%20String/README_EN.md) | `Two Pointers`,`String` | Medium | Weekly Contest 301 | | 2338 | [Count the Number of Ideal Arrays](/solution/2300-2399/2338.Count%20the%20Number%20of%20Ideal%20Arrays/README_EN.md) | `Math`,`Dynamic Programming`,`Combinatorics`,`Number Theory` | Hard | Weekly Contest 301 | | 2339 | [All the Matches of the League](/solution/2300-2399/2339.All%20the%20Matches%20of%20the%20League/README_EN.md) | `Database` | Easy | 🔒 |