diff --git a/solution/0500-0599/0557.Reverse Words in a String III/README.md b/solution/0500-0599/0557.Reverse Words in a String III/README.md
index 87ad806d27284..db4cce4b64360 100644
--- a/solution/0500-0599/0557.Reverse Words in a String III/README.md
+++ b/solution/0500-0599/0557.Reverse Words in a String III/README.md
@@ -20,8 +20,8 @@
示例 2:
-输入: s = "God Ding"
-输出:"doG gniD"
+输入: s = "Mr Ding"
+输出:"rM gniD"
diff --git a/solution/0500-0599/0557.Reverse Words in a String III/README_EN.md b/solution/0500-0599/0557.Reverse Words in a String III/README_EN.md
index 083b24bcee914..01a01dea23681 100644
--- a/solution/0500-0599/0557.Reverse Words in a String III/README_EN.md
+++ b/solution/0500-0599/0557.Reverse Words in a String III/README_EN.md
@@ -8,12 +8,19 @@
Example 1:
-Input: s = "Let's take LeetCode contest"
-Output: "s'teL ekat edoCteeL tsetnoc"
-
Example 2:
-Input: s = "God Ding"
-Output: "doG gniD"
+
+
+Input: s = "Let's take LeetCode contest"
+Output: "s'teL ekat edoCteeL tsetnoc"
+
+Example 2:
+
+
+Input: s = "Mr Ding"
+Output: "rM gniD"
+
+
Constraints:
diff --git a/solution/1000-1099/1084.Sales Analysis III/README.md b/solution/1000-1099/1084.Sales Analysis III/README.md
index 44a00d317897a..60e1b4b611408 100644
--- a/solution/1000-1099/1084.Sales Analysis III/README.md
+++ b/solution/1000-1099/1084.Sales Analysis III/README.md
@@ -76,10 +76,10 @@ Product table:
| 1 | S8 |
+-------------+--------------+
解释:
-id为1的产品仅在2019年春季销售。
-id为2的产品在2019年春季销售,但也在2019年春季之后销售。
-id 3的产品在2019年春季之后销售。
-我们只退回产品1,因为它是2019年春季才销售的产品。
+id 为 1 的产品仅在 2019 年春季销售。
+id 为 2 的产品在 2019 年春季销售,但也在 2019 年春季之后销售。
+id 为 3 的产品在 2019 年春季之后销售。
+我们只返回 id 为 1 的产品,因为它是 2019 年春季才销售的产品。
## 解法
diff --git a/solution/1500-1599/1522.Diameter of N-Ary Tree/README.md b/solution/1500-1599/1522.Diameter of N-Ary Tree/README.md
index f869b4d797281..05088054ef6c8 100644
--- a/solution/1500-1599/1522.Diameter of N-Ary Tree/README.md
+++ b/solution/1500-1599/1522.Diameter of N-Ary Tree/README.md
@@ -6,7 +6,7 @@
-给定一棵 N 叉树的根节点 root
,计算这棵树的直径长度。
+给定一棵 N 叉树
的根节点 root
,计算这棵树的直径长度。
N 叉树的直径指的是树中任意两个节点间路径中 最长 路径的长度。这条路径可能经过根节点,也可能不经过根节点。
diff --git a/solution/1500-1599/1522.Diameter of N-Ary Tree/README_EN.md b/solution/1500-1599/1522.Diameter of N-Ary Tree/README_EN.md
index 6b746b622b8ab..bb3a3891de2bb 100644
--- a/solution/1500-1599/1522.Diameter of N-Ary Tree/README_EN.md
+++ b/solution/1500-1599/1522.Diameter of N-Ary Tree/README_EN.md
@@ -4,7 +4,7 @@
## Description
-Given a root
of an N-ary tree, you need to compute the length of the diameter of the tree.
+Given a root
of an N-ary tree
, you need to compute the length of the diameter of the tree.
The diameter of an N-ary tree is the length of the longest path between any two nodes in the tree. This path may or may not pass through the root.
diff --git a/solution/2400-2499/2431.Maximize Total Tastiness of Purchased Fruits/README.md b/solution/2400-2499/2431.Maximize Total Tastiness of Purchased Fruits/README.md
index 45f11370eb289..dd83245c179e0 100644
--- a/solution/2400-2499/2431.Maximize Total Tastiness of Purchased Fruits/README.md
+++ b/solution/2400-2499/2431.Maximize Total Tastiness of Purchased Fruits/README.md
@@ -26,8 +26,8 @@
注意:
- - 每种水果最多只能购买一次。
- - 一些水果你最多只能用一次折价券。
+ - 每个水果最多只能购买一次。
+ - 一个水果你最多只能用一次折价券。
diff --git a/solution/2400-2499/2436.Minimum Split Into Subarrays With GCD Greater Than One/README.md b/solution/2400-2499/2436.Minimum Split Into Subarrays With GCD Greater Than One/README.md
index 17069dd0e7936..692421f2285a6 100644
--- a/solution/2400-2499/2436.Minimum Split Into Subarrays With GCD Greater Than One/README.md
+++ b/solution/2400-2499/2436.Minimum Split Into Subarrays With GCD Greater Than One/README.md
@@ -8,7 +8,7 @@
给定一个由正整数组成的数组 nums
。
-将数组拆分为 一个或多个 不相连的子数组,如下所示:
+将数组拆分为 一个或多个 互相不覆盖的子数组,如下所示:
- 数组中的每个元素都 只属于一个 子数组,并且
diff --git a/solution/2600-2699/2661.First Completely Painted Row or Column/README.md b/solution/2600-2699/2661.First Completely Painted Row or Column/README.md
index 0b16a62a5905f..c3adaaa0b37b3 100644
--- a/solution/2600-2699/2661.First Completely Painted Row or Column/README.md
+++ b/solution/2600-2699/2661.First Completely Painted Row or Column/README.md
@@ -10,7 +10,7 @@
从下标 0
开始遍历 arr
中的每个下标 i
,并将包含整数 arr[i]
的 mat
单元格涂色。
-请你找出 arr
中在 mat
的某一行或某一列上都被涂色且下标最小的元素,并返回其下标 i
。
+请你找出 arr
中第一个使得 mat
的某一行或某一列都被涂色的元素,并返回其下标 i
。
diff --git a/solution/2700-2799/2715.Timeout Cancellation/README_EN.md b/solution/2700-2799/2715.Timeout Cancellation/README_EN.md
index 2bdd13fea5fe6..6e134bf7f92d1 100644
--- a/solution/2700-2799/2715.Timeout Cancellation/README_EN.md
+++ b/solution/2700-2799/2715.Timeout Cancellation/README_EN.md
@@ -6,35 +6,44 @@
Given a function fn
, an array of arguments args
, and a timeout t
in milliseconds, return a cancel function cancelFn
.
-After a delay of t
, fn
should be called with args
passed as parameters unless cancelFn
was invoked before the delay of t
milliseconds elapses, specifically at cancelT
ms. In that case, fn
should never be called.
+After a delay of cancelT
, the returned cancel function cancelFn
will be invoked.
+
+
+setTimeout(cancelFn, cancelT)
+
+
+Initially, the execution of the function fn
should be delayed by t
milliseconds.
+
+If, before the delay of t
milliseconds, the function cancelFn
is invoked, it should cancel the delayed execution of fn
. Otherwise, if cancelFn
is not invoked within the specified delay t
, fn
should be executed with the provided args
as arguments.
Example 1:
-Input: fn = (x) => x * 5, args = [2], t = 20, cancelT = 50
+Input: fn = (x) => x * 5, args = [2], t = 20
Output: [{"time": 20, "returned": 10}]
Explanation:
-const result = []
+const cancelT = 50;
+const result = [];
-const fn = (x) => x * 5
+const fn = (x) => x * 5;
-const start = performance.now()
+const start = performance.now();
const log = (...argsArr) => {
const diff = Math.floor(performance.now() - start);
- result.push({"time": diff, "returned": fn(...argsArr)})
+ result.push({"time": diff, "returned": fn(...argsArr)});
}
const cancel = cancellable(log, [2], 20);
-const maxT = Math.max(t, 50)
+const maxT = Math.max(t, 50);
-setTimeout(cancel, cancelT)
+setTimeout(cancel, cancelT);
setTimeout(() => {
- console.log(result) // [{"time":20,"returned":10}]
-}, 65)
+ console.log(result); // [{"time":20,"returned":10}]
+}, 65);
The cancellation was scheduled to occur after a delay of cancelT (50ms), which happened after the execution of fn(2) at 20ms.
@@ -42,17 +51,21 @@ The cancellation was scheduled to occur after a delay of cancelT (50ms), which h
Example 2:
-Input: fn = (x) => x**2, args = [2], t = 100, cancelT = 50
+Input: fn = (x) => x**2, args = [2], t = 100
Output: []
-Explanation: The cancellation was scheduled to occur after a delay of cancelT (50ms), which happened before the execution of fn(2) at 100ms, resulting in fn(2) never being called.
+Explanation:
+const cancelT = 50;
+The cancellation was scheduled to occur after a delay of cancelT (50ms), which happened before the execution of fn(2) at 100ms, resulting in fn(2) never being called.
Example 3:
-Input: fn = (x1, x2) => x1 * x2, args = [2,4], t = 30, cancelT = 100
+Input: fn = (x1, x2) => x1 * x2, args = [2,4], t = 30
Output: [{"time": 30, "returned": 8}]
-Explanation: The cancellation was scheduled to occur after a delay of cancelT (100ms), which happened after the execution of fn(2,4) at 30ms.
+Explanation:
+const cancelT = 100;
+The cancellation was scheduled to occur after a delay of cancelT (100ms), which happened after the execution of fn(2,4) at 30ms.
diff --git a/solution/2900-2999/2948.Make Lexicographically Smallest Array by Swapping Elements/README.md b/solution/2900-2999/2948.Make Lexicographically Smallest Array by Swapping Elements/README.md
index 61942253a120f..e2a94fb123be9 100644
--- a/solution/2900-2999/2948.Make Lexicographically Smallest Array by Swapping Elements/README.md
+++ b/solution/2900-2999/2948.Make Lexicographically Smallest Array by Swapping Elements/README.md
@@ -12,7 +12,7 @@
返回执行任意次操作后能得到的 字典序最小的数组 。
-如果在数组 a
和数组 b
第一个不同的位置上,数组 a
中的对应字符比数组 b
中的对应字符的字典序更小,则认为数组 a
就比数组 b
字典序更小。例如,数组 [2,10,3]
比数组 [10,2,3]
字典序更小,下标 0
处是两个数组第一个不同的位置,且 2 < 10
。
+如果在数组 a
和数组 b
第一个不同的位置上,数组 a
中的对应元素比数组 b
中的对应元素的字典序更小,则认为数组 a
就比数组 b
字典序更小。例如,数组 [2,10,3]
比数组 [10,2,3]
字典序更小,下标 0
处是两个数组第一个不同的位置,且 2 < 10
。
diff --git a/solution/2900-2999/2955.Number of Same-End Substrings/README.md b/solution/2900-2999/2955.Number of Same-End Substrings/README.md
new file mode 100644
index 0000000000000..7323583b26ab6
--- /dev/null
+++ b/solution/2900-2999/2955.Number of Same-End Substrings/README.md
@@ -0,0 +1,90 @@
+# [2955. Number of Same-End Substrings](https://leetcode.cn/problems/number-of-same-end-substrings)
+
+[English Version](/solution/2900-2999/2955.Number%20of%20Same-End%20Substrings/README_EN.md)
+
+## 题目描述
+
+
+
+You are given a 0-indexed string s
, and a 2D array of integers queries
, where queries[i] = [li, ri]
indicates a substring of s
starting from the index li
and ending at the index ri
(both inclusive), i.e. s[li..ri]
.
+
+Return an array ans
where ans[i]
is the number of same-end substrings of queries[i]
.
+
+A 0-indexed string t
of length n
is called same-end if it has the same character at both of its ends, i.e., t[0] == t[n - 1]
.
+
+A substring is a contiguous non-empty sequence of characters within a string.
+
+
+Example 1:
+
+
+Input: s = "abcaab", queries = [[0,0],[1,4],[2,5],[0,5]]
+Output: [1,5,5,10]
+Explanation: Here is the same-end substrings of each query:
+1st query: s[0..0] is "a" which has 1 same-end substring: "a".
+2nd query: s[1..4] is "bcaa" which has 5 same-end substrings: "bcaa", "bcaa", "bcaa", "bcaa", "bcaa".
+3rd query: s[2..5] is "caab" which has 5 same-end substrings: "caab", "caab", "caab", "caab", "caab".
+4th query: s[0..5] is "abcaab" which has 10 same-end substrings: "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab".
+
+
+Example 2:
+
+
+Input: s = "abcd", queries = [[0,3]]
+Output: [4]
+Explanation: The only query is s[0..3] which is "abcd". It has 4 same-end substrings: "abcd", "abcd", "abcd", "abcd".
+
+
+
+Constraints:
+
+
+ 2 <= s.length <= 3 * 104
+ s
consists only of lowercase English letters.
+ 1 <= queries.length <= 3 * 104
+ queries[i].length == 2
+ queries[i] = [li, ri]
+ 0 <= li <= ri < s.length
+
+
+## 解法
+
+
+
+
+
+### **Python3**
+
+
+
+```python
+
+```
+
+### **Java**
+
+
+
+```java
+
+```
+
+### **C++**
+
+```cpp
+
+```
+
+### **Go**
+
+```go
+
+```
+
+### **...**
+
+```
+
+```
+
+
diff --git a/solution/2900-2999/2955.Number of Same-End Substrings/README_EN.md b/solution/2900-2999/2955.Number of Same-End Substrings/README_EN.md
new file mode 100644
index 0000000000000..814c19816557d
--- /dev/null
+++ b/solution/2900-2999/2955.Number of Same-End Substrings/README_EN.md
@@ -0,0 +1,82 @@
+# [2955. Number of Same-End Substrings](https://leetcode.com/problems/number-of-same-end-substrings)
+
+[中文文档](/solution/2900-2999/2955.Number%20of%20Same-End%20Substrings/README.md)
+
+## Description
+
+You are given a 0-indexed string s
, and a 2D array of integers queries
, where queries[i] = [li, ri]
indicates a substring of s
starting from the index li
and ending at the index ri
(both inclusive), i.e. s[li..ri]
.
+
+Return an array ans
where ans[i]
is the number of same-end substrings of queries[i]
.
+
+A 0-indexed string t
of length n
is called same-end if it has the same character at both of its ends, i.e., t[0] == t[n - 1]
.
+
+A substring is a contiguous non-empty sequence of characters within a string.
+
+
+Example 1:
+
+
+Input: s = "abcaab", queries = [[0,0],[1,4],[2,5],[0,5]]
+Output: [1,5,5,10]
+Explanation: Here is the same-end substrings of each query:
+1st query: s[0..0] is "a" which has 1 same-end substring: "a".
+2nd query: s[1..4] is "bcaa" which has 5 same-end substrings: "bcaa", "bcaa", "bcaa", "bcaa", "bcaa".
+3rd query: s[2..5] is "caab" which has 5 same-end substrings: "caab", "caab", "caab", "caab", "caab".
+4th query: s[0..5] is "abcaab" which has 10 same-end substrings: "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab", "abcaab".
+
+
+Example 2:
+
+
+Input: s = "abcd", queries = [[0,3]]
+Output: [4]
+Explanation: The only query is s[0..3] which is "abcd". It has 4 same-end substrings: "abcd", "abcd", "abcd", "abcd".
+
+
+
+Constraints:
+
+
+ 2 <= s.length <= 3 * 104
+ s
consists only of lowercase English letters.
+ 1 <= queries.length <= 3 * 104
+ queries[i].length == 2
+ queries[i] = [li, ri]
+ 0 <= li <= ri < s.length
+
+
+## Solutions
+
+
+
+### **Python3**
+
+```python
+
+```
+
+### **Java**
+
+```java
+
+```
+
+### **C++**
+
+```cpp
+
+```
+
+### **Go**
+
+```go
+
+```
+
+### **...**
+
+```
+
+```
+
+
diff --git a/solution/README.md b/solution/README.md
index 2d55f769b02a9..fc1d884069216 100644
--- a/solution/README.md
+++ b/solution/README.md
@@ -1294,7 +1294,7 @@
| 1281 | [整数的各位积和之差](/solution/1200-1299/1281.Subtract%20the%20Product%20and%20Sum%20of%20Digits%20of%20an%20Integer/README.md) | `数学` | 简单 | 第 166 场周赛 |
| 1282 | [用户分组](/solution/1200-1299/1282.Group%20the%20People%20Given%20the%20Group%20Size%20They%20Belong%20To/README.md) | `数组`,`哈希表` | 中等 | 第 166 场周赛 |
| 1283 | [使结果不超过阈值的最小除数](/solution/1200-1299/1283.Find%20the%20Smallest%20Divisor%20Given%20a%20Threshold/README.md) | `数组`,`二分查找` | 中等 | 第 166 场周赛 |
-| 1284 | [转化为全零矩阵的最少反转次数](/solution/1200-1299/1284.Minimum%20Number%20of%20Flips%20to%20Convert%20Binary%20Matrix%20to%20Zero%20Matrix/README.md) | `位运算`,`广度优先搜索`,`数组`,`矩阵` | 困难 | 第 166 场周赛 |
+| 1284 | [转化为全零矩阵的最少反转次数](/solution/1200-1299/1284.Minimum%20Number%20of%20Flips%20to%20Convert%20Binary%20Matrix%20to%20Zero%20Matrix/README.md) | `位运算`,`广度优先搜索`,`数组`,`哈希表`,`矩阵` | 困难 | 第 166 场周赛 |
| 1285 | [找到连续区间的开始和结束数字](/solution/1200-1299/1285.Find%20the%20Start%20and%20End%20Number%20of%20Continuous%20Ranges/README.md) | `数据库` | 中等 | 🔒 |
| 1286 | [字母组合迭代器](/solution/1200-1299/1286.Iterator%20for%20Combination/README.md) | `设计`,`字符串`,`回溯`,`迭代器` | 中等 | 第 15 场双周赛 |
| 1287 | [有序数组中出现次数超过25%的元素](/solution/1200-1299/1287.Element%20Appearing%20More%20Than%2025%25%20In%20Sorted%20Array/README.md) | `数组` | 简单 | 第 15 场双周赛 |
@@ -1895,7 +1895,7 @@
| 1882 | [使用服务器处理任务](/solution/1800-1899/1882.Process%20Tasks%20Using%20Servers/README.md) | `数组`,`堆(优先队列)` | 中等 | 第 243 场周赛 |
| 1883 | [准时抵达会议现场的最小跳过休息次数](/solution/1800-1899/1883.Minimum%20Skips%20to%20Arrive%20at%20Meeting%20On%20Time/README.md) | `数组`,`动态规划` | 困难 | 第 243 场周赛 |
| 1884 | [鸡蛋掉落-两枚鸡蛋](/solution/1800-1899/1884.Egg%20Drop%20With%202%20Eggs%20and%20N%20Floors/README.md) | `数学`,`动态规划` | 中等 | |
-| 1885 | [统计数对](/solution/1800-1899/1885.Count%20Pairs%20in%20Two%20Arrays/README.md) | `数组`,`二分查找`,`排序` | 中等 | 🔒 |
+| 1885 | [统计数对](/solution/1800-1899/1885.Count%20Pairs%20in%20Two%20Arrays/README.md) | `数组`,`双指针`,`二分查找`,`排序` | 中等 | 🔒 |
| 1886 | [判断矩阵经轮转后是否一致](/solution/1800-1899/1886.Determine%20Whether%20Matrix%20Can%20Be%20Obtained%20By%20Rotation/README.md) | `数组`,`矩阵` | 简单 | 第 244 场周赛 |
| 1887 | [使数组元素相等的减少操作次数](/solution/1800-1899/1887.Reduction%20Operations%20to%20Make%20the%20Array%20Elements%20Equal/README.md) | `数组`,`排序` | 中等 | 第 244 场周赛 |
| 1888 | [使二进制字符串字符交替的最少反转次数](/solution/1800-1899/1888.Minimum%20Number%20of%20Flips%20to%20Make%20the%20Binary%20String%20Alternating/README.md) | `贪心`,`字符串`,`动态规划`,`滑动窗口` | 中等 | 第 244 场周赛 |
@@ -2593,7 +2593,7 @@
| 2580 | [统计将重叠区间合并成组的方案数](/solution/2500-2599/2580.Count%20Ways%20to%20Group%20Overlapping%20Ranges/README.md) | `数组`,`排序` | 中等 | 第 99 场双周赛 |
| 2581 | [统计可能的树根数目](/solution/2500-2599/2581.Count%20Number%20of%20Possible%20Root%20Nodes/README.md) | `树`,`深度优先搜索`,`哈希表`,`动态规划` | 困难 | 第 99 场双周赛 |
| 2582 | [递枕头](/solution/2500-2599/2582.Pass%20the%20Pillow/README.md) | `数学`,`模拟` | 简单 | 第 335 场周赛 |
-| 2583 | [二叉树中的第 K 大层和](/solution/2500-2599/2583.Kth%20Largest%20Sum%20in%20a%20Binary%20Tree/README.md) | `树`,`广度优先搜索`,`二分查找` | 中等 | 第 335 场周赛 |
+| 2583 | [二叉树中的第 K 大层和](/solution/2500-2599/2583.Kth%20Largest%20Sum%20in%20a%20Binary%20Tree/README.md) | `树`,`广度优先搜索`,`二叉树`,`排序` | 中等 | 第 335 场周赛 |
| 2584 | [分割数组使乘积互质](/solution/2500-2599/2584.Split%20the%20Array%20to%20Make%20Coprime%20Products/README.md) | `数组`,`哈希表`,`数学`,`数论` | 困难 | 第 335 场周赛 |
| 2585 | [获得分数的方法数](/solution/2500-2599/2585.Number%20of%20Ways%20to%20Earn%20Points/README.md) | `数组`,`动态规划` | 困难 | 第 335 场周赛 |
| 2586 | [统计范围内的元音字符串数](/solution/2500-2599/2586.Count%20the%20Number%20of%20Vowel%20Strings%20in%20Range/README.md) | `数组`,`字符串` | 简单 | 第 336 场周赛 |
@@ -2960,11 +2960,12 @@
| 2947 | [统计美丽子字符串 I](/solution/2900-2999/2947.Count%20Beautiful%20Substrings%20I/README.md) | `字符串`,`枚举`,`前缀和` | 中等 | 第 373 场周赛 |
| 2948 | [交换得到字典序最小的数组](/solution/2900-2999/2948.Make%20Lexicographically%20Smallest%20Array%20by%20Swapping%20Elements/README.md) | `并查集`,`数组`,`排序` | 中等 | 第 373 场周赛 |
| 2949 | [统计美丽子字符串 II](/solution/2900-2999/2949.Count%20Beautiful%20Substrings%20II/README.md) | `哈希表`,`数学`,`字符串`,`数论`,`前缀和` | 困难 | 第 373 场周赛 |
-| 2950 | [可整除子串的数量](/solution/2900-2999/2950.Number%20of%20Divisible%20Substrings/README.md) | | 中等 | 🔒 |
-| 2951 | [找出峰值](/solution/2900-2999/2951.Find%20the%20Peaks/README.md) | | 简单 | 第 374 场周赛 |
-| 2952 | [需要添加的硬币的最小数量](/solution/2900-2999/2952.Minimum%20Number%20of%20Coins%20to%20be%20Added/README.md) | | 中等 | 第 374 场周赛 |
-| 2953 | [统计完全子字符串](/solution/2900-2999/2953.Count%20Complete%20Substrings/README.md) | | 中等 | 第 374 场周赛 |
-| 2954 | [统计感冒序列的数目](/solution/2900-2999/2954.Count%20the%20Number%20of%20Infection%20Sequences/README.md) | | 困难 | 第 374 场周赛 |
+| 2950 | [可整除子串的数量](/solution/2900-2999/2950.Number%20of%20Divisible%20Substrings/README.md) | `哈希表`,`字符串`,`计数` | 中等 | 🔒 |
+| 2951 | [找出峰值](/solution/2900-2999/2951.Find%20the%20Peaks/README.md) | `数组`,`枚举` | 简单 | 第 374 场周赛 |
+| 2952 | [需要添加的硬币的最小数量](/solution/2900-2999/2952.Minimum%20Number%20of%20Coins%20to%20be%20Added/README.md) | `贪心`,`数组`,`排序` | 困难 | 第 374 场周赛 |
+| 2953 | [统计完全子字符串](/solution/2900-2999/2953.Count%20Complete%20Substrings/README.md) | `哈希表`,`字符串`,`滑动窗口` | 中等 | 第 374 场周赛 |
+| 2954 | [统计感冒序列的数目](/solution/2900-2999/2954.Count%20the%20Number%20of%20Infection%20Sequences/README.md) | `数组`,`数学`,`组合数学` | 困难 | 第 374 场周赛 |
+| 2955 | [Number of Same-End Substrings](/solution/2900-2999/2955.Number%20of%20Same-End%20Substrings/README.md) | | 中等 | 🔒 |
## 版权
diff --git a/solution/README_EN.md b/solution/README_EN.md
index 0ba480b7f4932..ac61bd473c8dc 100644
--- a/solution/README_EN.md
+++ b/solution/README_EN.md
@@ -1292,7 +1292,7 @@ Press Control + F(or Command + F on
| 1281 | [Subtract the Product and Sum of Digits of an Integer](/solution/1200-1299/1281.Subtract%20the%20Product%20and%20Sum%20of%20Digits%20of%20an%20Integer/README_EN.md) | `Math` | Easy | Weekly Contest 166 |
| 1282 | [Group the People Given the Group Size They Belong To](/solution/1200-1299/1282.Group%20the%20People%20Given%20the%20Group%20Size%20They%20Belong%20To/README_EN.md) | `Array`,`Hash Table` | Medium | Weekly Contest 166 |
| 1283 | [Find the Smallest Divisor Given a Threshold](/solution/1200-1299/1283.Find%20the%20Smallest%20Divisor%20Given%20a%20Threshold/README_EN.md) | `Array`,`Binary Search` | Medium | Weekly Contest 166 |
-| 1284 | [Minimum Number of Flips to Convert Binary Matrix to Zero Matrix](/solution/1200-1299/1284.Minimum%20Number%20of%20Flips%20to%20Convert%20Binary%20Matrix%20to%20Zero%20Matrix/README_EN.md) | `Bit Manipulation`,`Breadth-First Search`,`Array`,`Matrix` | Hard | Weekly Contest 166 |
+| 1284 | [Minimum Number of Flips to Convert Binary Matrix to Zero Matrix](/solution/1200-1299/1284.Minimum%20Number%20of%20Flips%20to%20Convert%20Binary%20Matrix%20to%20Zero%20Matrix/README_EN.md) | `Bit Manipulation`,`Breadth-First Search`,`Array`,`Hash Table`,`Matrix` | Hard | Weekly Contest 166 |
| 1285 | [Find the Start and End Number of Continuous Ranges](/solution/1200-1299/1285.Find%20the%20Start%20and%20End%20Number%20of%20Continuous%20Ranges/README_EN.md) | `Database` | Medium | 🔒 |
| 1286 | [Iterator for Combination](/solution/1200-1299/1286.Iterator%20for%20Combination/README_EN.md) | `Design`,`String`,`Backtracking`,`Iterator` | Medium | Biweekly Contest 15 |
| 1287 | [Element Appearing More Than 25% In Sorted Array](/solution/1200-1299/1287.Element%20Appearing%20More%20Than%2025%25%20In%20Sorted%20Array/README_EN.md) | `Array` | Easy | Biweekly Contest 15 |
@@ -1893,7 +1893,7 @@ Press Control + F(or Command + F on
| 1882 | [Process Tasks Using Servers](/solution/1800-1899/1882.Process%20Tasks%20Using%20Servers/README_EN.md) | `Array`,`Heap (Priority Queue)` | Medium | Weekly Contest 243 |
| 1883 | [Minimum Skips to Arrive at Meeting On Time](/solution/1800-1899/1883.Minimum%20Skips%20to%20Arrive%20at%20Meeting%20On%20Time/README_EN.md) | `Array`,`Dynamic Programming` | Hard | Weekly Contest 243 |
| 1884 | [Egg Drop With 2 Eggs and N Floors](/solution/1800-1899/1884.Egg%20Drop%20With%202%20Eggs%20and%20N%20Floors/README_EN.md) | `Math`,`Dynamic Programming` | Medium | |
-| 1885 | [Count Pairs in Two Arrays](/solution/1800-1899/1885.Count%20Pairs%20in%20Two%20Arrays/README_EN.md) | `Array`,`Binary Search`,`Sorting` | Medium | 🔒 |
+| 1885 | [Count Pairs in Two Arrays](/solution/1800-1899/1885.Count%20Pairs%20in%20Two%20Arrays/README_EN.md) | `Array`,`Two Pointers`,`Binary Search`,`Sorting` | Medium | 🔒 |
| 1886 | [Determine Whether Matrix Can Be Obtained By Rotation](/solution/1800-1899/1886.Determine%20Whether%20Matrix%20Can%20Be%20Obtained%20By%20Rotation/README_EN.md) | `Array`,`Matrix` | Easy | Weekly Contest 244 |
| 1887 | [Reduction Operations to Make the Array Elements Equal](/solution/1800-1899/1887.Reduction%20Operations%20to%20Make%20the%20Array%20Elements%20Equal/README_EN.md) | `Array`,`Sorting` | Medium | Weekly Contest 244 |
| 1888 | [Minimum Number of Flips to Make the Binary String Alternating](/solution/1800-1899/1888.Minimum%20Number%20of%20Flips%20to%20Make%20the%20Binary%20String%20Alternating/README_EN.md) | `Greedy`,`String`,`Dynamic Programming`,`Sliding Window` | Medium | Weekly Contest 244 |
@@ -2591,7 +2591,7 @@ Press Control + F(or Command + F on
| 2580 | [Count Ways to Group Overlapping Ranges](/solution/2500-2599/2580.Count%20Ways%20to%20Group%20Overlapping%20Ranges/README_EN.md) | `Array`,`Sorting` | Medium | Biweekly Contest 99 |
| 2581 | [Count Number of Possible Root Nodes](/solution/2500-2599/2581.Count%20Number%20of%20Possible%20Root%20Nodes/README_EN.md) | `Tree`,`Depth-First Search`,`Hash Table`,`Dynamic Programming` | Hard | Biweekly Contest 99 |
| 2582 | [Pass the Pillow](/solution/2500-2599/2582.Pass%20the%20Pillow/README_EN.md) | `Math`,`Simulation` | Easy | Weekly Contest 335 |
-| 2583 | [Kth Largest Sum in a Binary Tree](/solution/2500-2599/2583.Kth%20Largest%20Sum%20in%20a%20Binary%20Tree/README_EN.md) | `Tree`,`Breadth-First Search`,`Binary Search` | Medium | Weekly Contest 335 |
+| 2583 | [Kth Largest Sum in a Binary Tree](/solution/2500-2599/2583.Kth%20Largest%20Sum%20in%20a%20Binary%20Tree/README_EN.md) | `Tree`,`Breadth-First Search`,`Binary Tree`,`Sorting` | Medium | Weekly Contest 335 |
| 2584 | [Split the Array to Make Coprime Products](/solution/2500-2599/2584.Split%20the%20Array%20to%20Make%20Coprime%20Products/README_EN.md) | `Array`,`Hash Table`,`Math`,`Number Theory` | Hard | Weekly Contest 335 |
| 2585 | [Number of Ways to Earn Points](/solution/2500-2599/2585.Number%20of%20Ways%20to%20Earn%20Points/README_EN.md) | `Array`,`Dynamic Programming` | Hard | Weekly Contest 335 |
| 2586 | [Count the Number of Vowel Strings in Range](/solution/2500-2599/2586.Count%20the%20Number%20of%20Vowel%20Strings%20in%20Range/README_EN.md) | `Array`,`String` | Easy | Weekly Contest 336 |
@@ -2958,11 +2958,12 @@ Press Control + F(or Command + F on
| 2947 | [Count Beautiful Substrings I](/solution/2900-2999/2947.Count%20Beautiful%20Substrings%20I/README_EN.md) | `String`,`Enumeration`,`Prefix Sum` | Medium | Weekly Contest 373 |
| 2948 | [Make Lexicographically Smallest Array by Swapping Elements](/solution/2900-2999/2948.Make%20Lexicographically%20Smallest%20Array%20by%20Swapping%20Elements/README_EN.md) | `Union Find`,`Array`,`Sorting` | Medium | Weekly Contest 373 |
| 2949 | [Count Beautiful Substrings II](/solution/2900-2999/2949.Count%20Beautiful%20Substrings%20II/README_EN.md) | `Hash Table`,`Math`,`String`,`Number Theory`,`Prefix Sum` | Hard | Weekly Contest 373 |
-| 2950 | [Number of Divisible Substrings](/solution/2900-2999/2950.Number%20of%20Divisible%20Substrings/README_EN.md) | | Medium | 🔒 |
-| 2951 | [Find the Peaks](/solution/2900-2999/2951.Find%20the%20Peaks/README_EN.md) | | Easy | Weekly Contest 374 |
-| 2952 | [Minimum Number of Coins to be Added](/solution/2900-2999/2952.Minimum%20Number%20of%20Coins%20to%20be%20Added/README_EN.md) | | Medium | Weekly Contest 374 |
-| 2953 | [Count Complete Substrings](/solution/2900-2999/2953.Count%20Complete%20Substrings/README_EN.md) | | Medium | Weekly Contest 374 |
-| 2954 | [Count the Number of Infection Sequences](/solution/2900-2999/2954.Count%20the%20Number%20of%20Infection%20Sequences/README_EN.md) | | Hard | Weekly Contest 374 |
+| 2950 | [Number of Divisible Substrings](/solution/2900-2999/2950.Number%20of%20Divisible%20Substrings/README_EN.md) | `Hash Table`,`String`,`Counting` | Medium | 🔒 |
+| 2951 | [Find the Peaks](/solution/2900-2999/2951.Find%20the%20Peaks/README_EN.md) | `Array`,`Enumeration` | Easy | Weekly Contest 374 |
+| 2952 | [Minimum Number of Coins to be Added](/solution/2900-2999/2952.Minimum%20Number%20of%20Coins%20to%20be%20Added/README_EN.md) | `Greedy`,`Array`,`Sorting` | Hard | Weekly Contest 374 |
+| 2953 | [Count Complete Substrings](/solution/2900-2999/2953.Count%20Complete%20Substrings/README_EN.md) | `Hash Table`,`String`,`Sliding Window` | Medium | Weekly Contest 374 |
+| 2954 | [Count the Number of Infection Sequences](/solution/2900-2999/2954.Count%20the%20Number%20of%20Infection%20Sequences/README_EN.md) | `Array`,`Math`,`Combinatorics` | Hard | Weekly Contest 374 |
+| 2955 | [Number of Same-End Substrings](/solution/2900-2999/2955.Number%20of%20Same-End%20Substrings/README_EN.md) | | Medium | 🔒 |
## Copyright
diff --git a/solution/main.py b/solution/main.py
index 621c50b3d9db4..6b154320e04c6 100644
--- a/solution/main.py
+++ b/solution/main.py
@@ -50,7 +50,7 @@ def get_all_questions(self, retry: int = 3) -> List:
)
return resp.json()["stat_status_pairs"]
except Exception as e:
- print(e)
+ print('get_all_questions', e)
time.sleep(2)
return self.get_all_questions(retry - 1) if retry > 0 else []
@@ -100,7 +100,9 @@ def get_question_detail_en(self, question_title_slug: str, retry: int = 3) -> di
res = resp.json()
return res["data"]["question"] or {}
except Exception as e:
- print(e)
+ print('get_question_detail_en', e)
+ if 'is not defined' in str(e):
+ return {}
time.sleep(2)
return {}
@@ -170,7 +172,7 @@ def get_question_detail(self, question_title_slug: str, retry: int = 3) -> dict:
res = resp.json()
return res["data"]["question"] or {}
except Exception as e:
- print(e)
+ print('get_question_detail', e)
time.sleep(2)
return {}
diff --git a/solution/summary.md b/solution/summary.md
index 8e339248115bf..48cb7b7b590cd 100644
--- a/solution/summary.md
+++ b/solution/summary.md
@@ -3012,3 +3012,4 @@
- [2952.需要添加的硬币的最小数量](/solution/2900-2999/2952.Minimum%20Number%20of%20Coins%20to%20be%20Added/README.md)
- [2953.统计完全子字符串](/solution/2900-2999/2953.Count%20Complete%20Substrings/README.md)
- [2954.统计感冒序列的数目](/solution/2900-2999/2954.Count%20the%20Number%20of%20Infection%20Sequences/README.md)
+ - [2955.Number of Same-End Substrings](/solution/2900-2999/2955.Number%20of%20Same-End%20Substrings/README.md)
diff --git a/solution/summary_en.md b/solution/summary_en.md
index 5efd1139a28de..3fac05358fb0b 100644
--- a/solution/summary_en.md
+++ b/solution/summary_en.md
@@ -3012,3 +3012,4 @@
- [2952.Minimum Number of Coins to be Added](/solution/2900-2999/2952.Minimum%20Number%20of%20Coins%20to%20be%20Added/README_EN.md)
- [2953.Count Complete Substrings](/solution/2900-2999/2953.Count%20Complete%20Substrings/README_EN.md)
- [2954.Count the Number of Infection Sequences](/solution/2900-2999/2954.Count%20the%20Number%20of%20Infection%20Sequences/README_EN.md)
+ - [2955.Number of Same-End Substrings](/solution/2900-2999/2955.Number%20of%20Same-End%20Substrings/README_EN.md)