diff --git "a/lcp/LCP 12. \345\260\217\345\274\240\345\210\267\351\242\230\350\256\241\345\210\222/README.md" "b/lcp/LCP 12. \345\260\217\345\274\240\345\210\267\351\242\230\350\256\241\345\210\222/README.md"
index 5e7935ae0e3df..a2da6fe9ec4ef 100644
--- "a/lcp/LCP 12. \345\260\217\345\274\240\345\210\267\351\242\230\350\256\241\345\210\222/README.md"
+++ "b/lcp/LCP 12. \345\260\217\345\274\240\345\210\267\351\242\230\350\256\241\345\210\222/README.md"
@@ -224,7 +224,7 @@ class Solution {
func minTime(_ time: [Int], _ m: Int) -> Int {
var left = 0
var right = time.reduce(0, +)
-
+
while left < right {
let mid = (left + right) / 2
if check(mid, time, m) {
@@ -235,12 +235,12 @@ class Solution {
}
return left
}
-
+
private func check(_ t: Int, _ time: [Int], _ m: Int) -> Bool {
var sum = 0
var maxTime = 0
var days = 1
-
+
for x in time {
sum += x
maxTime = max(maxTime, x)
diff --git a/solution/0300-0399/0384.Shuffle an Array/README.md b/solution/0300-0399/0384.Shuffle an Array/README.md
index 6781a689ac116..b77ff02e461d0 100644
--- a/solution/0300-0399/0384.Shuffle an Array/README.md
+++ b/solution/0300-0399/0384.Shuffle an Array/README.md
@@ -3,6 +3,7 @@ comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/0300-0399/0384.Shuffle%20an%20Array/README.md
tags:
+ - 设计
- 数组
- 数学
- 随机化
diff --git a/solution/0300-0399/0384.Shuffle an Array/README_EN.md b/solution/0300-0399/0384.Shuffle an Array/README_EN.md
index b341bcaa9b386..95f357c5fcb5f 100644
--- a/solution/0300-0399/0384.Shuffle an Array/README_EN.md
+++ b/solution/0300-0399/0384.Shuffle an Array/README_EN.md
@@ -3,6 +3,7 @@ comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/0300-0399/0384.Shuffle%20an%20Array/README_EN.md
tags:
+ - Design
- Array
- Math
- Randomized
diff --git a/solution/0400-0499/0490.The Maze/README.md b/solution/0400-0499/0490.The Maze/README.md
index 982e0298eb0c6..53f4fd880dcff 100644
--- a/solution/0400-0499/0490.The Maze/README.md
+++ b/solution/0400-0499/0490.The Maze/README.md
@@ -28,14 +28,14 @@ tags:
你可以 假定迷宫的边缘都是墙壁(参考示例)。
-
+
示例 1:
输入:maze = [[0,0,1,0,0],[0,0,0,0,0],[0,0,0,1,0],[1,1,0,1,1],[0,0,0,0,0]], start = [0,4], destination = [4,4]
输出:true
-解释:一种可能的路径是 : 左 -> 下 -> 左 -> 下 -> 右 -> 下 -> 右。
+解释:一种可能的路径是 : 左 -> 下 -> 左 -> 下 -> 右 -> 下 -> 右。
示例 2:
@@ -53,19 +53,19 @@ tags:
输出:false
-
+
提示:
m == maze.length
n == maze[i].length
- 1 <= m, n <= 100
+ 1 <= m, n <= 100
maze[i][j]
is 0
or 1
.
start.length == 2
destination.length == 2
- 0 <= startrow, destinationrow <= m
- 0 <= startcol, destinationcol <= n
+ 0 <= startrow, destinationrow < m
+ 0 <= startcol, destinationcol < n
- 球和目的地都在空地上,且初始时它们不在同一位置
- 迷宫 至少包括 2 块空地
diff --git a/solution/0400-0499/0490.The Maze/README_EN.md b/solution/0400-0499/0490.The Maze/README_EN.md
index 856f07c599629..85f43ef399544 100644
--- a/solution/0400-0499/0490.The Maze/README_EN.md
+++ b/solution/0400-0499/0490.The Maze/README_EN.md
@@ -59,8 +59,8 @@ tags:
maze[i][j]
is 0
or 1
.
start.length == 2
destination.length == 2
- 0 <= startrow, destinationrow <= m
- 0 <= startcol, destinationcol <= n
+ 0 <= startrow, destinationrow < m
+ 0 <= startcol, destinationcol < n
Both the ball and the destination exist in an empty space, and they will not be in the same position initially.
The maze contains at least 2 empty spaces.
diff --git a/solution/0500-0599/0500.Keyboard Row/README.md b/solution/0500-0599/0500.Keyboard Row/README.md
index d8b6ea018687d..606c7686335af 100644
--- a/solution/0500-0599/0500.Keyboard Row/README.md
+++ b/solution/0500-0599/0500.Keyboard Row/README.md
@@ -20,6 +20,8 @@ tags:
给你一个字符串数组 words
,只返回可以使用在 美式键盘 同一行的字母打印出来的单词。键盘如下图所示。
+请注意,字符串 不区分大小写,相同字母的大小写形式都被视为在同一行。
+
美式键盘 中:
@@ -30,36 +32,43 @@ tags:

-
+
示例 1:
-
-输入:words = ["Hello","Alaska","Dad","Peace"]
-输出:["Alaska","Dad"]
-
+
+
输入:words = ["Hello","Alaska","Dad","Peace"]
+
+
输出:["Alaska","Dad"]
+
+
解释:
+
+
由于不区分大小写,"a"
和 "A"
都在美式键盘的第二行。
+
示例 2:
-
-输入:words = ["omk"]
-输出:[]
-
+
+
输入:words = ["omk"]
+
+
输出:[]
+
+
+示例 3:
-示例 3:
+
+
输入:words = ["adsdf","sfd"]
-
-输入:words = ["adsdf","sfd"]
-输出:["adsdf","sfd"]
-
+
输出:["adsdf","sfd"]
+
-
+
提示:
- 1 <= words.length <= 20
- 1 <= words[i].length <= 100
+ 1 <= words.length <= 20
+ 1 <= words[i].length <= 100
words[i]
由英文字母(小写和大写字母)组成
diff --git a/solution/0500-0599/0500.Keyboard Row/README_EN.md b/solution/0500-0599/0500.Keyboard Row/README_EN.md
index 2053e2602ab8e..14901c4ed0121 100644
--- a/solution/0500-0599/0500.Keyboard Row/README_EN.md
+++ b/solution/0500-0599/0500.Keyboard Row/README_EN.md
@@ -20,6 +20,8 @@ tags:
Given an array of strings words
, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below.
+Note that the strings are case-insensitive, both lowercased and uppercased of the same letter are treated as if they are at the same row.
+
In the American keyboard:
@@ -31,24 +33,31 @@ tags:
Example 1:
-
-Input: words = ["Hello","Alaska","Dad","Peace"]
-Output: ["Alaska","Dad"]
-
+
+
Input: words = ["Hello","Alaska","Dad","Peace"]
+
+
Output: ["Alaska","Dad"]
+
+
Explanation:
+
+
Both "a"
and "A"
are in the 2nd row of the American keyboard due to case insensitivity.
+
Example 2:
-
-Input: words = ["omk"]
-Output: []
-
+
+
Input: words = ["omk"]
+
+
Output: []
+
Example 3:
-
-Input: words = ["adsdf","sfd"]
-Output: ["adsdf","sfd"]
-
+
+
Input: words = ["adsdf","sfd"]
+
+
Output: ["adsdf","sfd"]
+
Constraints:
diff --git a/solution/0700-0799/0777.Swap Adjacent in LR String/README.md b/solution/0700-0799/0777.Swap Adjacent in LR String/README.md
index d0e01ecfea320..7b4ea68a1007f 100644
--- a/solution/0700-0799/0777.Swap Adjacent in LR String/README.md
+++ b/solution/0700-0799/0777.Swap Adjacent in LR String/README.md
@@ -9,7 +9,7 @@ tags:
-# [777. 在LR字符串中交换相邻字符](https://leetcode.cn/problems/swap-adjacent-in-lr-string)
+# [777. 在 LR 字符串中交换相邻字符](https://leetcode.cn/problems/swap-adjacent-in-lr-string)
[English Version](/solution/0700-0799/0777.Swap%20Adjacent%20in%20LR%20String/README_EN.md)
@@ -17,16 +17,16 @@ tags:
-在一个由 'L'
, 'R'
和 'X'
三个字符组成的字符串(例如"RXXLRXRXL"
)中进行移动操作。一次移动操作指用一个 "LX"
替换一个 "XL"
,或者用一个 "XR"
替换一个 "RX"
。现给定起始字符串 start
和结束字符串 end
,请编写代码,当且仅当存在一系列移动操作使得 start
可以转换成 end
时, 返回 True
。
+在一个由 'L'
, 'R'
和 'X'
三个字符组成的字符串(例如"RXXLRXRXL"
)中进行移动操作。一次移动操作指用一个 "LX"
替换一个 "XL"
,或者用一个 "XR"
替换一个 "RX"
。现给定起始字符串 start
和结束字符串 result
,请编写代码,当且仅当存在一系列移动操作使得 start
可以转换成 result
时, 返回 True
。
示例 1:
-输入:start = "RXXLRXRXL", end = "XRLXXRRLX"
+输入:start = "RXXLRXRXL", result = "XRLXXRRLX"
输出:true
-解释:通过以下步骤我们可以将 start 转化为 end:
+解释:通过以下步骤我们可以将 start 转化为 result:
RXXLRXRXL ->
XRXLRXRXL ->
XRLXRXRXL ->
@@ -37,7 +37,7 @@ XRLXXRRLX
示例 2:
-输入:start = "X", end = "L"
+输入:start = "X", result = "L"
输出:false
@@ -47,8 +47,8 @@ XRLXXRRLX
1 <= start.length <= 104
- start.length == end.length
- start
和 end
都只包含 'L'
, 'R'
或 'X'
。
+ start.length == result.length
+ start
和 result
都只包含 'L'
, 'R'
或 'X'
。
diff --git a/solution/0900-0999/0909.Snakes and Ladders/README.md b/solution/0900-0999/0909.Snakes and Ladders/README.md
index 131d16da3ae80..f260b58f25623 100644
--- a/solution/0900-0999/0909.Snakes and Ladders/README.md
+++ b/solution/0900-0999/0909.Snakes and Ladders/README.md
@@ -36,13 +36,13 @@ tags:
如果 board[r][c] != -1
,位于 r
行 c
列的棋盘格中可能存在 “蛇” 或 “梯子”。那个蛇或梯子的目的地将会是 board[r][c]
。编号为 1
和 n2
的方格不是任何蛇或梯子的起点。
-注意,玩家在每回合的前进过程中最多只能爬过蛇或梯子一次:就算目的地是另一条蛇或梯子的起点,玩家也 不能 继续移动。
+注意,玩家在每次掷骰的前进过程中最多只能爬过蛇或梯子一次:就算目的地是另一条蛇或梯子的起点,玩家也 不能 继续移动。
- 举个例子,假设棋盘是
[[-1,4],[-1,3]]
,第一次移动,玩家的目标方格是 2
。那么这个玩家将会顺着梯子到达方格 3
,但 不能 顺着方格 3
上的梯子前往方格 4
。(简单来说,类似飞行棋,玩家掷出骰子点数后移动对应格数,遇到单向的路径(即梯子或蛇)可以直接跳到路径的终点,但如果多个路径首尾相连,也不能连续跳多个路径)
-返回达到编号为 n2
的方格所需的最少移动次数,如果不可能,则返回 -1
。
+返回达到编号为 n2
的方格所需的最少掷骰次数,如果不可能,则返回 -1
。
diff --git a/solution/1000-1099/1095.Find in Mountain Array/README.md b/solution/1000-1099/1095.Find in Mountain Array/README.md
index 9e07e971f3b13..d7bd8577057d4 100644
--- a/solution/1000-1099/1095.Find in Mountain Array/README.md
+++ b/solution/1000-1099/1095.Find in Mountain Array/README.md
@@ -53,14 +53,14 @@ tags:
示例 1:
-输入:array = [1,2,3,4,5,3,1], target = 3
+输入:mountainArr = [1,2,3,4,5,3,1], target = 3
输出:2
解释:3 在数组中出现了两次,下标分别为 2 和 5,我们返回最小的下标 2。
示例 2:
-输入:array = [0,1,2,4,2,1], target = 3
+输入:mountainArr = [0,1,2,4,2,1], target = 3
输出:-1
解释:3 在数组中没有出现,返回 -1。
@@ -70,9 +70,9 @@ tags:
提示:
- 3 <= mountain_arr.length() <= 104
+ 3 <= mountainArr.length() <= 104
0 <= target <= 109
- 0 <= mountain_arr.get(index) <= 109
+ 0 <= mountainArr.get(index) <= 109
diff --git a/solution/1000-1099/1095.Find in Mountain Array/README_EN.md b/solution/1000-1099/1095.Find in Mountain Array/README_EN.md
index 00281eb8a6b06..21c671e89649f 100644
--- a/solution/1000-1099/1095.Find in Mountain Array/README_EN.md
+++ b/solution/1000-1099/1095.Find in Mountain Array/README_EN.md
@@ -49,14 +49,14 @@ tags:
Example 1:
-Input: array = [1,2,3,4,5,3,1], target = 3
+Input: mountainArr = [1,2,3,4,5,3,1], target = 3
Output: 2
Explanation: 3 exists in the array, at index=2 and index=5. Return the minimum index, which is 2.
Example 2:
-Input: array = [0,1,2,4,2,1], target = 3
+Input: mountainArr = [0,1,2,4,2,1], target = 3
Output: -1
Explanation: 3 does not exist in the array,
so we return -1.
@@ -65,9 +65,9 @@ tags:
Constraints:
- 3 <= mountain_arr.length() <= 104
+ 3 <= mountainArr.length() <= 104
0 <= target <= 109
- 0 <= mountain_arr.get(index) <= 109
+ 0 <= mountainArr.get(index) <= 109
diff --git a/solution/1200-1299/1257.Smallest Common Region/README.md b/solution/1200-1299/1257.Smallest Common Region/README.md
index 22e842a30b49e..f54bd638bf99d 100644
--- a/solution/1200-1299/1257.Smallest Common Region/README.md
+++ b/solution/1200-1299/1257.Smallest Common Region/README.md
@@ -25,13 +25,13 @@ tags:
给你一些区域列表 regions
,每个列表的第一个区域都包含这个列表内所有其他区域。
-很自然地,如果区域 X
包含区域 Y
,那么区域 X
比区域 Y
大。
+很自然地,如果区域 x
包含区域 y
,那么区域 x
比区域 y
大。同时根据定义,区域 x
包含自身。
给定两个区域 region1
和 region2
,找到同时包含这两个区域的 最小 区域。
-如果区域列表中 r1
包含 r2
和 r3
,那么数据保证 r2
不会包含 r3
。
+如果给定区域 r1
,r2
和 r3
,使得 r1
包含 r3
,那么数据保证 r2
不会包含 r3
。
-数据同样保证最小公共区域一定存在。
+数据同样保证最小区域一定存在。
@@ -39,14 +39,21 @@ tags:
输入:
-regions = [["Earth","North America","South America"],
-["North America","United States","Canada"],
-["United States","New York","Boston"],
-["Canada","Ontario","Quebec"],
-["South America","Brazil"]],
-region1 = "Quebec",
-region2 = "New York"
-输出:"North America"
+regions = [["Earth","North America","South America"],
+["North America","United States","Canada"],
+["United States","New York","Boston"],
+["Canada","Ontario","Quebec"],
+["South America","Brazil"]],
+region1 = "Quebec",
+region2 = "New York"
+输出:"North America"
+
+
+示例 2:
+
+
+输入:regions = [["Earth", "North America", "South America"],["North America", "United States", "Canada"],["United States", "New York", "Boston"],["Canada", "Ontario", "Quebec"],["South America", "Brazil"]], region1 = "Canada", region2 = "South America"
+输出:"Earth"
@@ -54,9 +61,12 @@ region2 = "New York"
提示:
- 2 <= regions.length <= 10^4
+ 2 <= regions.length <= 104
+ 2 <= regions[i].length <= 20
+ 1 <= regions[i][j].length, region1.length, region2.length <= 20
region1 != region2
- - 所有字符串只包含英文字母和空格,且最多只有 20 个字母。
+ regions[i][j]
,region1
和 region2
由英语字母组成。
+ - 输入保证存在一个区域直接或间接包含所有其他区域。
diff --git a/solution/1300-1399/1317.Convert Integer to the Sum of Two No-Zero Integers/README.md b/solution/1300-1399/1317.Convert Integer to the Sum of Two No-Zero Integers/README.md
index df2390fb2d575..4c6df94597775 100644
--- a/solution/1300-1399/1317.Convert Integer to the Sum of Two No-Zero Integers/README.md
+++ b/solution/1300-1399/1317.Convert Integer to the Sum of Two No-Zero Integers/README.md
@@ -20,11 +20,11 @@ tags:
「无零整数」是十进制表示中 不含任何 0 的正整数。
-给你一个整数 n
,请你返回一个 由两个整数组成的列表 [A, B]
,满足:
+给你一个整数 n
,请你返回一个 由两个整数组成的列表 [a, b]
,满足:
- A
和 B
都是无零整数
- A + B = n
+ a
和 b
都是无零整数
+ a + b = n
题目数据保证至少有一个有效的解决方案。
@@ -35,32 +35,37 @@ tags:
示例 1:
-输入:n = 2
+
+输入:n = 2
输出:[1,1]
-解释:A = 1, B = 1. A + B = n 并且 A 和 B 的十进制表示形式都不包含任何 0 。
+解释:a = 1, b = 1。a + b = n 并且 a 和 b 的十进制表示形式都不包含任何 0。
示例 2:
-输入:n = 11
+
+输入:n = 11
输出:[2,9]
示例 3:
-输入:n = 10000
+
+输入:n = 10000
输出:[1,9999]
示例 4:
-输入:n = 69
+
+输入:n = 69
输出:[1,68]
示例 5:
-输入:n = 1010
+
+输入:n = 1010
输出:[11,999]
@@ -69,7 +74,7 @@ tags:
提示:
- 2 <= n <= 10^4
+ 2 <= n <= 104
diff --git a/solution/1300-1399/1317.Convert Integer to the Sum of Two No-Zero Integers/README_EN.md b/solution/1300-1399/1317.Convert Integer to the Sum of Two No-Zero Integers/README_EN.md
index d377b891d9ab4..5a4cf6eb73ffa 100644
--- a/solution/1300-1399/1317.Convert Integer to the Sum of Two No-Zero Integers/README_EN.md
+++ b/solution/1300-1399/1317.Convert Integer to the Sum of Two No-Zero Integers/README_EN.md
@@ -45,7 +45,7 @@ Both a and b are no-zero integers, and a + b = 2 = n.
Input: n = 11
Output: [2,9]
Explanation: Let a = 2 and b = 9.
-Both a and b are no-zero integers, and a + b = 9 = n.
+Both a and b are no-zero integers, and a + b = 11 = n.
Note that there are other valid answers as [8, 3] that can be accepted.
diff --git a/solution/1800-1899/1859.Sorting the Sentence/README_EN.md b/solution/1800-1899/1859.Sorting the Sentence/README_EN.md
index 8578b480eb04a..418733db1cb46 100644
--- a/solution/1800-1899/1859.Sorting the Sentence/README_EN.md
+++ b/solution/1800-1899/1859.Sorting the Sentence/README_EN.md
@@ -24,55 +24,37 @@ tags:
A sentence can be shuffled by appending the 1-indexed word position to each word then rearranging the words in the sentence.
-
- - For example, the sentence
"This is a sentence"
can be shuffled as "sentence4 a3 is2 This1"
or "is2 sentence4 This1 a3"
.
-
+ - For example, the sentence
"This is a sentence"
can be shuffled as "sentence4 a3 is2 This1"
or "is2 sentence4 This1 a3"
.
Given a shuffled sentence s
containing no more than 9
words, reconstruct and return the original sentence.
-
Example 1:
-
Input: s = "is2 sentence4 This1 a3"
-
Output: "This is a sentence"
-
Explanation: Sort the words in s to their original positions "This1 is2 a3 sentence4", then remove the numbers.
-
Example 2:
-
Input: s = "Myself2 Me1 I4 and3"
-
Output: "Me Myself and I"
-
Explanation: Sort the words in s to their original positions "Me1 Myself2 and3 I4", then remove the numbers.
-
-
Constraints:
-
- 2 <= s.length <= 200
-
- s
consists of lowercase and uppercase English letters, spaces, and digits from 1
to 9
.
-
- - The number of words in
s
is between 1
and 9
.
-
- - The words in
s
are separated by a single space.
-
- s
contains no leading or trailing spaces.
-
+ 2 <= s.length <= 200
+ s
consists of lowercase and uppercase English letters, spaces, and digits from 1
to 9
.
+ - The number of words in
s
is between 1
and 9
.
+ - The words in
s
are separated by a single space.
+ s
contains no leading or trailing spaces.
diff --git a/solution/2000-2099/2056.Number of Valid Move Combinations On Chessboard/README.md b/solution/2000-2099/2056.Number of Valid Move Combinations On Chessboard/README.md
index 91fea0d7ece99..4957f6fdc81eb 100644
--- a/solution/2000-2099/2056.Number of Valid Move Combinations On Chessboard/README.md
+++ b/solution/2000-2099/2056.Number of Valid Move Combinations On Chessboard/README.md
@@ -116,7 +116,7 @@ tags:
1 <= n <= 4
pieces
只包含字符串 "rook"
,"queen"
和 "bishop"
。
棋盘上总共最多只有一个后。
- 1 <= xi, yi <= 8
+ 1 <= ri, ci <= 8
每一个 positions[i]
互不相同。
diff --git a/solution/2000-2099/2056.Number of Valid Move Combinations On Chessboard/README_EN.md b/solution/2000-2099/2056.Number of Valid Move Combinations On Chessboard/README_EN.md
index c1e915b7abecf..808734a1bd51a 100644
--- a/solution/2000-2099/2056.Number of Valid Move Combinations On Chessboard/README_EN.md
+++ b/solution/2000-2099/2056.Number of Valid Move Combinations On Chessboard/README_EN.md
@@ -77,7 +77,7 @@ tags:
1 <= n <= 4
pieces
only contains the strings "rook"
, "queen"
, and "bishop"
.
There will be at most one queen on the chessboard.
- 1 <= xi, yi <= 8
+ 1 <= ri, ci <= 8
Each positions[i]
is distinct.
diff --git a/solution/2600-2699/2623.Memoize/README.md b/solution/2600-2699/2623.Memoize/README.md
index 1c6d49e34f7d7..e012a39bf4ba3 100644
--- a/solution/2600-2699/2623.Memoize/README.md
+++ b/solution/2600-2699/2623.Memoize/README.md
@@ -87,9 +87,10 @@ values = [[5],[]]
0 <= a, b <= 105
1 <= n <= 10
+ 1 <= actions.length <= 105
actions.length === values.length
actions[i]
为 "call" 和 "getCallCount" 中的一个
- fnName
为 "sum", "factorial" 和 "fib" 中的一个
+ fnName
为 "sum", "factorial" 和 "fib" 中的一个
diff --git a/solution/2600-2699/2694.Event Emitter/README.md b/solution/2600-2699/2694.Event Emitter/README.md
index c21976f360c43..96404ef0f95e9 100644
--- a/solution/2600-2699/2694.Event Emitter/README.md
+++ b/solution/2600-2699/2694.Event Emitter/README.md
@@ -78,7 +78,7 @@ emitter.emit("firstEvent", [4, 5, 6]); // [], 没有订阅者
输入:
actions = ["EventEmitter", "subscribe", "subscribe", "unsubscribe", "emit"],
values = [[], ["firstEvent", "x => x + 1"], ["firstEvent", "x => x + 2"], [0], ["firstEvent", [5]]]
-输出:[[],["subscribed"],["emitted",["1,2,3"]],["unsubscribed",0],["emitted",[7]]]
+输出:[[],["subscribed"],["subscribed"],["unsubscribed",0],["emitted",[7]]]
解释:
const emitter = new EventEmitter();
const sub1 = emitter.subscribe("firstEvent", x => x + 1);
diff --git a/solution/2600-2699/2694.Event Emitter/README_EN.md b/solution/2600-2699/2694.Event Emitter/README_EN.md
index 6759594507da2..df4221390cb54 100644
--- a/solution/2600-2699/2694.Event Emitter/README_EN.md
+++ b/solution/2600-2699/2694.Event Emitter/README_EN.md
@@ -79,7 +79,7 @@ emitter.emit("firstEvent", [4, 5, 6]); // [], there are no subscriptio
Input:
actions = ["EventEmitter", "subscribe", "subscribe", "unsubscribe", "emit"],
values = [[], ["firstEvent", "x => x + 1"], ["firstEvent", "x => x + 2"], [0], ["firstEvent", [5]]]
-Output: [[],["subscribed"],["emitted",["1,2,3"]],["unsubscribed",0],["emitted",[7]]]
+Output: [[],["subscribed"],["subscribed"],["unsubscribed",0],["emitted",[7]]]
Explanation:
const emitter = new EventEmitter();
const sub1 = emitter.subscribe("firstEvent", x => x + 1);
diff --git a/solution/2900-2999/2944.Minimum Number of Coins for Fruits/README.md b/solution/2900-2999/2944.Minimum Number of Coins for Fruits/README.md
index a5fdf8b774601..167074aa40056 100644
--- a/solution/2900-2999/2944.Minimum Number of Coins for Fruits/README.md
+++ b/solution/2900-2999/2944.Minimum Number of Coins for Fruits/README.md
@@ -22,14 +22,12 @@ tags:
-你在一个水果超市里,货架上摆满了玲琅满目的奇珍异果。
-
-给你一个下标从 1 开始的数组 prices
,其中 prices[i]
表示你购买第 i
个水果需要花费的金币数目。
+给你一个 下标从 1 开始的 整数数组 prices
,其中 prices[i]
表示你购买第 i
个水果需要花费的金币数目。
水果超市有如下促销活动:
- - 如果你花费
price[i]
购买了下标为 i
的水果,那么你可以免费获得下标范围在 [i + 1, i + i]
的水果。
+ - 如果你花费
prices[i]
购买了下标为 i
的水果,那么你可以免费获得下标范围在 [i + 1, i + i]
的水果。
注意 ,即使你 可以 免费获得水果 j
,你仍然可以花费 prices[j]
个金币去购买它以获得它的奖励。
diff --git a/solution/2900-2999/2944.Minimum Number of Coins for Fruits/README_EN.md b/solution/2900-2999/2944.Minimum Number of Coins for Fruits/README_EN.md
index fc6d3b6e7be53..c269d8314e373 100644
--- a/solution/2900-2999/2944.Minimum Number of Coins for Fruits/README_EN.md
+++ b/solution/2900-2999/2944.Minimum Number of Coins for Fruits/README_EN.md
@@ -22,12 +22,12 @@ tags:
-You are given an integer array prices
where prices[i]
denotes the number of coins needed to purchase the ith
fruit.
+You are given an 1-indexed integer array prices
where prices[i]
denotes the number of coins needed to purchase the ith
fruit.
The fruit market has the following reward for each fruit:
- - If you purchase the
ith
fruit at prices[i]
coins, you can get any number of the next (i + 1)
fruits for free.
+ - If you purchase the
ith
fruit at prices[i]
coins, you can get any number of the next i
fruits for free.
Note that even if you can take fruit j
for free, you can still purchase it for prices[j]
coins to receive its reward.
diff --git a/solution/3300-3399/3314.Construct the Minimum Bitwise Array I/README.md b/solution/3300-3399/3314.Construct the Minimum Bitwise Array I/README.md
index 017f4a2fae88d..e4044291622c7 100644
--- a/solution/3300-3399/3314.Construct the Minimum Bitwise Array I/README.md
+++ b/solution/3300-3399/3314.Construct the Minimum Bitwise Array I/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 简单
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3314.Construct%20the%20Minimum%20Bitwise%20Array%20I/README.md
+rating: 1378
+source: 第 141 场双周赛 Q1
tags:
- 位运算
- 数组
diff --git a/solution/3300-3399/3314.Construct the Minimum Bitwise Array I/README_EN.md b/solution/3300-3399/3314.Construct the Minimum Bitwise Array I/README_EN.md
index e2c4536d7f2fd..a3d6dc240aea3 100644
--- a/solution/3300-3399/3314.Construct the Minimum Bitwise Array I/README_EN.md
+++ b/solution/3300-3399/3314.Construct the Minimum Bitwise Array I/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3314.Construct%20the%20Minimum%20Bitwise%20Array%20I/README_EN.md
+rating: 1378
+source: Biweekly Contest 141 Q1
tags:
- Bit Manipulation
- Array
diff --git a/solution/3300-3399/3315.Construct the Minimum Bitwise Array II/README.md b/solution/3300-3399/3315.Construct the Minimum Bitwise Array II/README.md
index 02dae50a9bd9c..0888633a82511 100644
--- a/solution/3300-3399/3315.Construct the Minimum Bitwise Array II/README.md
+++ b/solution/3300-3399/3315.Construct the Minimum Bitwise Array II/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3315.Construct%20the%20Minimum%20Bitwise%20Array%20II/README.md
+rating: 1714
+source: 第 141 场双周赛 Q2
tags:
- 位运算
- 数组
diff --git a/solution/3300-3399/3315.Construct the Minimum Bitwise Array II/README_EN.md b/solution/3300-3399/3315.Construct the Minimum Bitwise Array II/README_EN.md
index d24fe77a17264..625cdd14cd43b 100644
--- a/solution/3300-3399/3315.Construct the Minimum Bitwise Array II/README_EN.md
+++ b/solution/3300-3399/3315.Construct the Minimum Bitwise Array II/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3315.Construct%20the%20Minimum%20Bitwise%20Array%20II/README_EN.md
+rating: 1714
+source: Biweekly Contest 141 Q2
tags:
- Bit Manipulation
- Array
diff --git a/solution/3300-3399/3316.Find Maximum Removals From Source String/README.md b/solution/3300-3399/3316.Find Maximum Removals From Source String/README.md
index 1e401ea7e5c20..a56876a5c3173 100644
--- a/solution/3300-3399/3316.Find Maximum Removals From Source String/README.md
+++ b/solution/3300-3399/3316.Find Maximum Removals From Source String/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3316.Find%20Maximum%20Removals%20From%20Source%20String/README.md
+rating: 2062
+source: 第 141 场双周赛 Q3
tags:
- 数组
- 哈希表
diff --git a/solution/3300-3399/3316.Find Maximum Removals From Source String/README_EN.md b/solution/3300-3399/3316.Find Maximum Removals From Source String/README_EN.md
index 3c83f2c940da1..399961daa0093 100644
--- a/solution/3300-3399/3316.Find Maximum Removals From Source String/README_EN.md
+++ b/solution/3300-3399/3316.Find Maximum Removals From Source String/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3316.Find%20Maximum%20Removals%20From%20Source%20String/README_EN.md
+rating: 2062
+source: Biweekly Contest 141 Q3
tags:
- Array
- Hash Table
diff --git a/solution/3300-3399/3317.Find the Number of Possible Ways for an Event/README.md b/solution/3300-3399/3317.Find the Number of Possible Ways for an Event/README.md
index ad49c17f04cfc..2912d859b6619 100644
--- a/solution/3300-3399/3317.Find the Number of Possible Ways for an Event/README.md
+++ b/solution/3300-3399/3317.Find the Number of Possible Ways for an Event/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3317.Find%20the%20Number%20of%20Possible%20Ways%20for%20an%20Event/README.md
+rating: 2413
+source: 第 141 场双周赛 Q4
tags:
- 数学
- 动态规划
diff --git a/solution/3300-3399/3317.Find the Number of Possible Ways for an Event/README_EN.md b/solution/3300-3399/3317.Find the Number of Possible Ways for an Event/README_EN.md
index d23cee3b2cfbf..c02f932b77250 100644
--- a/solution/3300-3399/3317.Find the Number of Possible Ways for an Event/README_EN.md
+++ b/solution/3300-3399/3317.Find the Number of Possible Ways for an Event/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3317.Find%20the%20Number%20of%20Possible%20Ways%20for%20an%20Event/README_EN.md
+rating: 2413
+source: Biweekly Contest 141 Q4
tags:
- Math
- Dynamic Programming
diff --git a/solution/3300-3399/3318.Find X-Sum of All K-Long Subarrays I/README.md b/solution/3300-3399/3318.Find X-Sum of All K-Long Subarrays I/README.md
index 7783225448051..5cf065fe6afef 100644
--- a/solution/3300-3399/3318.Find X-Sum of All K-Long Subarrays I/README.md
+++ b/solution/3300-3399/3318.Find X-Sum of All K-Long Subarrays I/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 简单
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3318.Find%20X-Sum%20of%20All%20K-Long%20Subarrays%20I/README.md
+rating: 1457
+source: 第 419 场周赛 Q1
tags:
- 数组
- 哈希表
diff --git a/solution/3300-3399/3318.Find X-Sum of All K-Long Subarrays I/README_EN.md b/solution/3300-3399/3318.Find X-Sum of All K-Long Subarrays I/README_EN.md
index 94c4a419b6c92..6672fc4706bdc 100644
--- a/solution/3300-3399/3318.Find X-Sum of All K-Long Subarrays I/README_EN.md
+++ b/solution/3300-3399/3318.Find X-Sum of All K-Long Subarrays I/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3318.Find%20X-Sum%20of%20All%20K-Long%20Subarrays%20I/README_EN.md
+rating: 1457
+source: Weekly Contest 419 Q1
tags:
- Array
- Hash Table
diff --git a/solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/README.md b/solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/README.md
index 60f93f9b3f0cf..7b19c8e24268c 100644
--- a/solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/README.md
+++ b/solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3319.K-th%20Largest%20Perfect%20Subtree%20Size%20in%20Binary%20Tree/README.md
+rating: 1603
+source: 第 419 场周赛 Q2
tags:
- 树
- 深度优先搜索
diff --git a/solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/README_EN.md b/solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/README_EN.md
index 1c4353ef2d369..056e565492d2f 100644
--- a/solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/README_EN.md
+++ b/solution/3300-3399/3319.K-th Largest Perfect Subtree Size in Binary Tree/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3319.K-th%20Largest%20Perfect%20Subtree%20Size%20in%20Binary%20Tree/README_EN.md
+rating: 1603
+source: Weekly Contest 419 Q2
tags:
- Tree
- Depth-First Search
diff --git a/solution/3300-3399/3320.Count The Number of Winning Sequences/README.md b/solution/3300-3399/3320.Count The Number of Winning Sequences/README.md
index 5fb78f3564b47..56bfef572d355 100644
--- a/solution/3300-3399/3320.Count The Number of Winning Sequences/README.md
+++ b/solution/3300-3399/3320.Count The Number of Winning Sequences/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3320.Count%20The%20Number%20of%20Winning%20Sequences/README.md
+rating: 2153
+source: 第 419 场周赛 Q3
tags:
- 字符串
- 动态规划
diff --git a/solution/3300-3399/3320.Count The Number of Winning Sequences/README_EN.md b/solution/3300-3399/3320.Count The Number of Winning Sequences/README_EN.md
index 1972b87a463ca..444532f2a68b6 100644
--- a/solution/3300-3399/3320.Count The Number of Winning Sequences/README_EN.md
+++ b/solution/3300-3399/3320.Count The Number of Winning Sequences/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3320.Count%20The%20Number%20of%20Winning%20Sequences/README_EN.md
+rating: 2153
+source: Weekly Contest 419 Q3
tags:
- String
- Dynamic Programming
diff --git a/solution/3300-3399/3321.Find X-Sum of All K-Long Subarrays II/README.md b/solution/3300-3399/3321.Find X-Sum of All K-Long Subarrays II/README.md
index b255f40c499c4..bdc1c78e86c45 100644
--- a/solution/3300-3399/3321.Find X-Sum of All K-Long Subarrays II/README.md
+++ b/solution/3300-3399/3321.Find X-Sum of All K-Long Subarrays II/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3321.Find%20X-Sum%20of%20All%20K-Long%20Subarrays%20II/README.md
+rating: 2598
+source: 第 419 场周赛 Q4
tags:
- 数组
- 哈希表
diff --git a/solution/3300-3399/3321.Find X-Sum of All K-Long Subarrays II/README_EN.md b/solution/3300-3399/3321.Find X-Sum of All K-Long Subarrays II/README_EN.md
index 247e1b59f02f8..7d676552bafe8 100644
--- a/solution/3300-3399/3321.Find X-Sum of All K-Long Subarrays II/README_EN.md
+++ b/solution/3300-3399/3321.Find X-Sum of All K-Long Subarrays II/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3321.Find%20X-Sum%20of%20All%20K-Long%20Subarrays%20II/README_EN.md
+rating: 2598
+source: Weekly Contest 419 Q4
tags:
- Array
- Hash Table
diff --git a/solution/3300-3399/3324.Find the Sequence of Strings Appeared on the Screen/README.md b/solution/3300-3399/3324.Find the Sequence of Strings Appeared on the Screen/README.md
index f2feb30499d9b..0a96eaa22387d 100644
--- a/solution/3300-3399/3324.Find the Sequence of Strings Appeared on the Screen/README.md
+++ b/solution/3300-3399/3324.Find the Sequence of Strings Appeared on the Screen/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3324.Find%20the%20Sequence%20of%20Strings%20Appeared%20on%20the%20Screen/README.md
+rating: 1293
+source: 第 420 场周赛 Q1
tags:
- 字符串
- 模拟
diff --git a/solution/3300-3399/3324.Find the Sequence of Strings Appeared on the Screen/README_EN.md b/solution/3300-3399/3324.Find the Sequence of Strings Appeared on the Screen/README_EN.md
index 601234de324b2..804dfda7683e8 100644
--- a/solution/3300-3399/3324.Find the Sequence of Strings Appeared on the Screen/README_EN.md
+++ b/solution/3300-3399/3324.Find the Sequence of Strings Appeared on the Screen/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3324.Find%20the%20Sequence%20of%20Strings%20Appeared%20on%20the%20Screen/README_EN.md
+rating: 1293
+source: Weekly Contest 420 Q1
tags:
- String
- Simulation
diff --git a/solution/3300-3399/3325.Count Substrings With K-Frequency Characters I/README.md b/solution/3300-3399/3325.Count Substrings With K-Frequency Characters I/README.md
index 93761f31e34fb..290aeabd4e25b 100644
--- a/solution/3300-3399/3325.Count Substrings With K-Frequency Characters I/README.md
+++ b/solution/3300-3399/3325.Count Substrings With K-Frequency Characters I/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3325.Count%20Substrings%20With%20K-Frequency%20Characters%20I/README.md
+rating: 1454
+source: 第 420 场周赛 Q2
tags:
- 哈希表
- 字符串
diff --git a/solution/3300-3399/3325.Count Substrings With K-Frequency Characters I/README_EN.md b/solution/3300-3399/3325.Count Substrings With K-Frequency Characters I/README_EN.md
index f5d189505892e..bad8c13731d51 100644
--- a/solution/3300-3399/3325.Count Substrings With K-Frequency Characters I/README_EN.md
+++ b/solution/3300-3399/3325.Count Substrings With K-Frequency Characters I/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3325.Count%20Substrings%20With%20K-Frequency%20Characters%20I/README_EN.md
+rating: 1454
+source: Weekly Contest 420 Q2
tags:
- Hash Table
- String
diff --git a/solution/3300-3399/3326.Minimum Division Operations to Make Array Non Decreasing/README.md b/solution/3300-3399/3326.Minimum Division Operations to Make Array Non Decreasing/README.md
index 7a8e8b441e537..32226346c2c09 100644
--- a/solution/3300-3399/3326.Minimum Division Operations to Make Array Non Decreasing/README.md
+++ b/solution/3300-3399/3326.Minimum Division Operations to Make Array Non Decreasing/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3326.Minimum%20Division%20Operations%20to%20Make%20Array%20Non%20Decreasing/README.md
+rating: 1864
+source: 第 420 场周赛 Q3
tags:
- 贪心
- 数组
diff --git a/solution/3300-3399/3326.Minimum Division Operations to Make Array Non Decreasing/README_EN.md b/solution/3300-3399/3326.Minimum Division Operations to Make Array Non Decreasing/README_EN.md
index 5e6d7609f02fd..22e2d562470de 100644
--- a/solution/3300-3399/3326.Minimum Division Operations to Make Array Non Decreasing/README_EN.md
+++ b/solution/3300-3399/3326.Minimum Division Operations to Make Array Non Decreasing/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3326.Minimum%20Division%20Operations%20to%20Make%20Array%20Non%20Decreasing/README_EN.md
+rating: 1864
+source: Weekly Contest 420 Q3
tags:
- Greedy
- Array
diff --git a/solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README.md b/solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README.md
index 043f1dfbd358c..9ed9cae91e589 100644
--- a/solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README.md
+++ b/solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3327.Check%20if%20DFS%20Strings%20Are%20Palindromes/README.md
+rating: 2454
+source: 第 420 场周赛 Q4
tags:
- 树
- 深度优先搜索
diff --git a/solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README_EN.md b/solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README_EN.md
index 09680e6c4c74c..1333ab1327add 100644
--- a/solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README_EN.md
+++ b/solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3327.Check%20if%20DFS%20Strings%20Are%20Palindromes/README_EN.md
+rating: 2454
+source: Weekly Contest 420 Q4
tags:
- Tree
- Depth-First Search
diff --git a/solution/3300-3399/3330.Find the Original Typed String I/README.md b/solution/3300-3399/3330.Find the Original Typed String I/README.md
index b68a474e12cdd..5c9ac9f00ee7e 100644
--- a/solution/3300-3399/3330.Find the Original Typed String I/README.md
+++ b/solution/3300-3399/3330.Find the Original Typed String I/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 简单
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3330.Find%20the%20Original%20Typed%20String%20I/README.md
+rating: 1338
+source: 第 142 场双周赛 Q1
tags:
- 字符串
---
diff --git a/solution/3300-3399/3330.Find the Original Typed String I/README_EN.md b/solution/3300-3399/3330.Find the Original Typed String I/README_EN.md
index 702b8b2a16d58..e6708d554969c 100644
--- a/solution/3300-3399/3330.Find the Original Typed String I/README_EN.md
+++ b/solution/3300-3399/3330.Find the Original Typed String I/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3330.Find%20the%20Original%20Typed%20String%20I/README_EN.md
+rating: 1338
+source: Biweekly Contest 142 Q1
tags:
- String
---
diff --git a/solution/3300-3399/3331.Find Subtree Sizes After Changes/README.md b/solution/3300-3399/3331.Find Subtree Sizes After Changes/README.md
index 64e9d7779a3cc..45655238350a7 100644
--- a/solution/3300-3399/3331.Find Subtree Sizes After Changes/README.md
+++ b/solution/3300-3399/3331.Find Subtree Sizes After Changes/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3331.Find%20Subtree%20Sizes%20After%20Changes/README.md
+rating: 2045
+source: 第 142 场双周赛 Q2
tags:
- 树
- 深度优先搜索
diff --git a/solution/3300-3399/3331.Find Subtree Sizes After Changes/README_EN.md b/solution/3300-3399/3331.Find Subtree Sizes After Changes/README_EN.md
index a974bae5c974b..c3a3810b5462e 100644
--- a/solution/3300-3399/3331.Find Subtree Sizes After Changes/README_EN.md
+++ b/solution/3300-3399/3331.Find Subtree Sizes After Changes/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3331.Find%20Subtree%20Sizes%20After%20Changes/README_EN.md
+rating: 2045
+source: Biweekly Contest 142 Q2
tags:
- Tree
- Depth-First Search
diff --git a/solution/3300-3399/3332.Maximum Points Tourist Can Earn/README.md b/solution/3300-3399/3332.Maximum Points Tourist Can Earn/README.md
index 503251b7614b0..5d3078c53ba3e 100644
--- a/solution/3300-3399/3332.Maximum Points Tourist Can Earn/README.md
+++ b/solution/3300-3399/3332.Maximum Points Tourist Can Earn/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3332.Maximum%20Points%20Tourist%20Can%20Earn/README.md
+rating: 1827
+source: 第 142 场双周赛 Q3
tags:
- 数组
- 动态规划
diff --git a/solution/3300-3399/3332.Maximum Points Tourist Can Earn/README_EN.md b/solution/3300-3399/3332.Maximum Points Tourist Can Earn/README_EN.md
index 8f186f0129bc7..831f3b058c974 100644
--- a/solution/3300-3399/3332.Maximum Points Tourist Can Earn/README_EN.md
+++ b/solution/3300-3399/3332.Maximum Points Tourist Can Earn/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3332.Maximum%20Points%20Tourist%20Can%20Earn/README_EN.md
+rating: 1827
+source: Biweekly Contest 142 Q3
tags:
- Array
- Dynamic Programming
diff --git a/solution/3300-3399/3333.Find the Original Typed String II/README.md b/solution/3300-3399/3333.Find the Original Typed String II/README.md
index 027c1f56019f7..2f146eea6be79 100644
--- a/solution/3300-3399/3333.Find the Original Typed String II/README.md
+++ b/solution/3300-3399/3333.Find the Original Typed String II/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3333.Find%20the%20Original%20Typed%20String%20II/README.md
+rating: 2628
+source: 第 142 场双周赛 Q4
tags:
- 字符串
- 动态规划
diff --git a/solution/3300-3399/3333.Find the Original Typed String II/README_EN.md b/solution/3300-3399/3333.Find the Original Typed String II/README_EN.md
index 7a42fcd213ad8..88fd2da02fb2c 100644
--- a/solution/3300-3399/3333.Find the Original Typed String II/README_EN.md
+++ b/solution/3300-3399/3333.Find the Original Typed String II/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3333.Find%20the%20Original%20Typed%20String%20II/README_EN.md
+rating: 2628
+source: Biweekly Contest 142 Q4
tags:
- String
- Dynamic Programming
diff --git a/solution/3300-3399/3334.Find the Maximum Factor Score of Array/README.md b/solution/3300-3399/3334.Find the Maximum Factor Score of Array/README.md
index ee3be01c48bd6..99cbd743f55f2 100644
--- a/solution/3300-3399/3334.Find the Maximum Factor Score of Array/README.md
+++ b/solution/3300-3399/3334.Find the Maximum Factor Score of Array/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3334.Find%20the%20Maximum%20Factor%20Score%20of%20Array/README.md
+rating: 1518
+source: 第 421 场周赛 Q1
tags:
- 数组
- 数学
diff --git a/solution/3300-3399/3334.Find the Maximum Factor Score of Array/README_EN.md b/solution/3300-3399/3334.Find the Maximum Factor Score of Array/README_EN.md
index f2b6bb85978ee..4226140102de3 100644
--- a/solution/3300-3399/3334.Find the Maximum Factor Score of Array/README_EN.md
+++ b/solution/3300-3399/3334.Find the Maximum Factor Score of Array/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3334.Find%20the%20Maximum%20Factor%20Score%20of%20Array/README_EN.md
+rating: 1518
+source: Weekly Contest 421 Q1
tags:
- Array
- Math
diff --git a/solution/3300-3399/3335.Total Characters in String After Transformations I/README.md b/solution/3300-3399/3335.Total Characters in String After Transformations I/README.md
index 803e83832527b..950893ee82e13 100644
--- a/solution/3300-3399/3335.Total Characters in String After Transformations I/README.md
+++ b/solution/3300-3399/3335.Total Characters in String After Transformations I/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3335.Total%20Characters%20in%20String%20After%20Transformations%20I/README.md
+rating: 1806
+source: 第 421 场周赛 Q2
tags:
- 哈希表
- 数学
diff --git a/solution/3300-3399/3335.Total Characters in String After Transformations I/README_EN.md b/solution/3300-3399/3335.Total Characters in String After Transformations I/README_EN.md
index b5f2ed836ddcb..dfc8513a27e26 100644
--- a/solution/3300-3399/3335.Total Characters in String After Transformations I/README_EN.md
+++ b/solution/3300-3399/3335.Total Characters in String After Transformations I/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3335.Total%20Characters%20in%20String%20After%20Transformations%20I/README_EN.md
+rating: 1806
+source: Weekly Contest 421 Q2
tags:
- Hash Table
- Math
diff --git a/solution/3300-3399/3336.Find the Number of Subsequences With Equal GCD/README.md b/solution/3300-3399/3336.Find the Number of Subsequences With Equal GCD/README.md
index c5f9b8468c147..f314692b7210c 100644
--- a/solution/3300-3399/3336.Find the Number of Subsequences With Equal GCD/README.md
+++ b/solution/3300-3399/3336.Find the Number of Subsequences With Equal GCD/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3336.Find%20the%20Number%20of%20Subsequences%20With%20Equal%20GCD/README.md
+rating: 2402
+source: 第 421 场周赛 Q3
tags:
- 数组
- 数学
diff --git a/solution/3300-3399/3336.Find the Number of Subsequences With Equal GCD/README_EN.md b/solution/3300-3399/3336.Find the Number of Subsequences With Equal GCD/README_EN.md
index 54937439fe939..5b900e2b4fe87 100644
--- a/solution/3300-3399/3336.Find the Number of Subsequences With Equal GCD/README_EN.md
+++ b/solution/3300-3399/3336.Find the Number of Subsequences With Equal GCD/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3336.Find%20the%20Number%20of%20Subsequences%20With%20Equal%20GCD/README_EN.md
+rating: 2402
+source: Weekly Contest 421 Q3
tags:
- Array
- Math
diff --git a/solution/3300-3399/3337.Total Characters in String After Transformations II/README.md b/solution/3300-3399/3337.Total Characters in String After Transformations II/README.md
index 26f128d93e293..0cfe618ae042a 100644
--- a/solution/3300-3399/3337.Total Characters in String After Transformations II/README.md
+++ b/solution/3300-3399/3337.Total Characters in String After Transformations II/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3337.Total%20Characters%20in%20String%20After%20Transformations%20II/README.md
+rating: 2411
+source: 第 421 场周赛 Q4
tags:
- 哈希表
- 数学
diff --git a/solution/3300-3399/3337.Total Characters in String After Transformations II/README_EN.md b/solution/3300-3399/3337.Total Characters in String After Transformations II/README_EN.md
index 1e3ba5e6aea8e..8088af730786c 100644
--- a/solution/3300-3399/3337.Total Characters in String After Transformations II/README_EN.md
+++ b/solution/3300-3399/3337.Total Characters in String After Transformations II/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3337.Total%20Characters%20in%20String%20After%20Transformations%20II/README_EN.md
+rating: 2411
+source: Weekly Contest 421 Q4
tags:
- Hash Table
- Math
diff --git a/solution/3300-3399/3340.Check Balanced String/README.md b/solution/3300-3399/3340.Check Balanced String/README.md
index f107c94d4713e..7267b417f0f61 100644
--- a/solution/3300-3399/3340.Check Balanced String/README.md
+++ b/solution/3300-3399/3340.Check Balanced String/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 简单
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3340.Check%20Balanced%20String/README.md
+rating: 1190
+source: 第 422 场周赛 Q1
tags:
- 字符串
---
diff --git a/solution/3300-3399/3340.Check Balanced String/README_EN.md b/solution/3300-3399/3340.Check Balanced String/README_EN.md
index f174facb93812..a3d84bbb4a42b 100644
--- a/solution/3300-3399/3340.Check Balanced String/README_EN.md
+++ b/solution/3300-3399/3340.Check Balanced String/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3340.Check%20Balanced%20String/README_EN.md
+rating: 1190
+source: Weekly Contest 422 Q1
tags:
- String
---
diff --git a/solution/3300-3399/3341.Find Minimum Time to Reach Last Room I/README.md b/solution/3300-3399/3341.Find Minimum Time to Reach Last Room I/README.md
index 364565a827492..ab8618f39a512 100644
--- a/solution/3300-3399/3341.Find Minimum Time to Reach Last Room I/README.md
+++ b/solution/3300-3399/3341.Find Minimum Time to Reach Last Room I/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3341.Find%20Minimum%20Time%20to%20Reach%20Last%20Room%20I/README.md
+rating: 1721
+source: 第 422 场周赛 Q2
tags:
- 图
- 数组
diff --git a/solution/3300-3399/3341.Find Minimum Time to Reach Last Room I/README_EN.md b/solution/3300-3399/3341.Find Minimum Time to Reach Last Room I/README_EN.md
index f44c667220e08..eb0c654f6e62d 100644
--- a/solution/3300-3399/3341.Find Minimum Time to Reach Last Room I/README_EN.md
+++ b/solution/3300-3399/3341.Find Minimum Time to Reach Last Room I/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3341.Find%20Minimum%20Time%20to%20Reach%20Last%20Room%20I/README_EN.md
+rating: 1721
+source: Weekly Contest 422 Q2
tags:
- Graph
- Array
diff --git a/solution/3300-3399/3342.Find Minimum Time to Reach Last Room II/README.md b/solution/3300-3399/3342.Find Minimum Time to Reach Last Room II/README.md
index c34481b8bc319..ee5bc219b1c5f 100644
--- a/solution/3300-3399/3342.Find Minimum Time to Reach Last Room II/README.md
+++ b/solution/3300-3399/3342.Find Minimum Time to Reach Last Room II/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3342.Find%20Minimum%20Time%20to%20Reach%20Last%20Room%20II/README.md
+rating: 1861
+source: 第 422 场周赛 Q3
tags:
- 图
- 数组
diff --git a/solution/3300-3399/3342.Find Minimum Time to Reach Last Room II/README_EN.md b/solution/3300-3399/3342.Find Minimum Time to Reach Last Room II/README_EN.md
index 8fc2a3b39e2fa..e9dd0768112ee 100644
--- a/solution/3300-3399/3342.Find Minimum Time to Reach Last Room II/README_EN.md
+++ b/solution/3300-3399/3342.Find Minimum Time to Reach Last Room II/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3342.Find%20Minimum%20Time%20to%20Reach%20Last%20Room%20II/README_EN.md
+rating: 1861
+source: Weekly Contest 422 Q3
tags:
- Graph
- Array
diff --git a/solution/3300-3399/3343.Count Number of Balanced Permutations/README.md b/solution/3300-3399/3343.Count Number of Balanced Permutations/README.md
index cb84d730105ab..dac4ebcc67205 100644
--- a/solution/3300-3399/3343.Count Number of Balanced Permutations/README.md
+++ b/solution/3300-3399/3343.Count Number of Balanced Permutations/README.md
@@ -2,6 +2,8 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3343.Count%20Number%20of%20Balanced%20Permutations/README.md
+rating: 2614
+source: 第 422 场周赛 Q4
tags:
- 数学
- 字符串
diff --git a/solution/3300-3399/3343.Count Number of Balanced Permutations/README_EN.md b/solution/3300-3399/3343.Count Number of Balanced Permutations/README_EN.md
index 1ca3211a9522e..5c1e5db223468 100644
--- a/solution/3300-3399/3343.Count Number of Balanced Permutations/README_EN.md
+++ b/solution/3300-3399/3343.Count Number of Balanced Permutations/README_EN.md
@@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3343.Count%20Number%20of%20Balanced%20Permutations/README_EN.md
+rating: 2614
+source: Weekly Contest 422 Q4
tags:
- Math
- String
diff --git a/solution/3300-3399/3353.Minimum Total Operations/README.md b/solution/3300-3399/3353.Minimum Total Operations/README.md
new file mode 100644
index 0000000000000..9e33b636efdcc
--- /dev/null
+++ b/solution/3300-3399/3353.Minimum Total Operations/README.md
@@ -0,0 +1,149 @@
+---
+comments: true
+difficulty: 简单
+edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3353.Minimum%20Total%20Operations/README.md
+---
+
+
+
+# [3353. Minimum Total Operations 🔒](https://leetcode.cn/problems/minimum-total-operations)
+
+[English Version](/solution/3300-3399/3353.Minimum%20Total%20Operations/README_EN.md)
+
+## 题目描述
+
+
+
+Given an array of integers nums
, you can perform any number of operations on this array.
+
+In each operation, you can:
+
+
+ - Choose a prefix of the array.
+ - Choose an integer
k
(which can be negative) and add k
to each element in the chosen prefix.
+
+
+A prefix of an array is a subarray that starts from the beginning of the array and extends to any point within it.
+
+Return the minimum number of operations required to make all elements in arr
equal.
+
+
+Example 1:
+
+
+
Input: nums = [1,4,2]
+
+
Output: 2
+
+
Explanation:
+
+
+ - Operation 1: Choose the prefix
[1, 4]
of length 2 and add -2 to each element of the prefix. The array becomes [-1, 2, 2]
.
+ - Operation 2: Choose the prefix
[-1]
of length 1 and add 3 to it. The array becomes [2, 2, 2]
.
+ - Thus, the minimum number of required operations is 2.
+
+
+
+Example 2:
+
+
+
Input: nums = [10,10,10]
+
+
Output: 0
+
+
Explanation:
+
+
+ - All elements are already equal, so no operations are needed.
+
+
+
+
+Constraints:
+
+
+ 1 <= nums.length <= 105
+ -109 <= nums[i] <= 109
+
+
+
+
+## 解法
+
+
+
+### 方法一:一次遍历
+
+我们可以遍历数组,对于每个元素,如果它与前一个元素不相等,那么就需要进行一次操作,最后返回操作的次数即可。
+
+时间复杂度 $O(n)$,其中 $n$ 为数组的长度。空间复杂度 $O(1)$。
+
+
+
+#### Python3
+
+```python
+class Solution:
+ def minOperations(self, nums: List[int]) -> int:
+ return sum(x != y for x, y in pairwise(nums))
+```
+
+#### Java
+
+```java
+class Solution {
+ public int minOperations(int[] nums) {
+ int ans = 0;
+ for (int i = 1; i < nums.length; ++i) {
+ ans += nums[i] != nums[i - 1] ? 1 : 0;
+ }
+ return ans;
+ }
+}
+```
+
+#### C++
+
+```cpp
+class Solution {
+public:
+ int minOperations(vector& nums) {
+ int ans = 0;
+ for (int i = 1; i < nums.size(); ++i) {
+ ans += nums[i] != nums[i - 1];
+ }
+ return ans;
+ }
+};
+```
+
+#### Go
+
+```go
+func minOperations(nums []int) (ans int) {
+ for i, x := range nums[1:] {
+ if x != nums[i] {
+ ans++
+ }
+ }
+ return
+}
+```
+
+#### TypeScript
+
+```ts
+function minOperations(nums: number[]): number {
+ let ans = 0;
+ for (let i = 1; i < nums.length; ++i) {
+ ans += nums[i] !== nums[i - 1] ? 1 : 0;
+ }
+ return ans;
+}
+```
+
+
+
+
+
+
diff --git a/solution/3300-3399/3353.Minimum Total Operations/README_EN.md b/solution/3300-3399/3353.Minimum Total Operations/README_EN.md
new file mode 100644
index 0000000000000..f872ebdf535b0
--- /dev/null
+++ b/solution/3300-3399/3353.Minimum Total Operations/README_EN.md
@@ -0,0 +1,149 @@
+---
+comments: true
+difficulty: Easy
+edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3353.Minimum%20Total%20Operations/README_EN.md
+---
+
+
+
+# [3353. Minimum Total Operations 🔒](https://leetcode.com/problems/minimum-total-operations)
+
+[中文文档](/solution/3300-3399/3353.Minimum%20Total%20Operations/README.md)
+
+## Description
+
+
+
+Given an array of integers nums
, you can perform any number of operations on this array.
+
+In each operation, you can:
+
+
+ - Choose a prefix of the array.
+ - Choose an integer
k
(which can be negative) and add k
to each element in the chosen prefix.
+
+
+A prefix of an array is a subarray that starts from the beginning of the array and extends to any point within it.
+
+Return the minimum number of operations required to make all elements in arr
equal.
+
+
+Example 1:
+
+
+
Input: nums = [1,4,2]
+
+
Output: 2
+
+
Explanation:
+
+
+ - Operation 1: Choose the prefix
[1, 4]
of length 2 and add -2 to each element of the prefix. The array becomes [-1, 2, 2]
.
+ - Operation 2: Choose the prefix
[-1]
of length 1 and add 3 to it. The array becomes [2, 2, 2]
.
+ - Thus, the minimum number of required operations is 2.
+
+
+
+Example 2:
+
+
+
Input: nums = [10,10,10]
+
+
Output: 0
+
+
Explanation:
+
+
+ - All elements are already equal, so no operations are needed.
+
+
+
+
+Constraints:
+
+
+ 1 <= nums.length <= 105
+ -109 <= nums[i] <= 109
+
+
+
+
+## Solutions
+
+
+
+### Solution 1: Single Pass
+
+We can traverse the array, and for each element, if it is not equal to the previous element, we need to perform an operation. Finally, we return the number of operations.
+
+The time complexity is $O(n)$, where $n$ is the length of the array. The space complexity is $O(1)$.
+
+
+
+#### Python3
+
+```python
+class Solution:
+ def minOperations(self, nums: List[int]) -> int:
+ return sum(x != y for x, y in pairwise(nums))
+```
+
+#### Java
+
+```java
+class Solution {
+ public int minOperations(int[] nums) {
+ int ans = 0;
+ for (int i = 1; i < nums.length; ++i) {
+ ans += nums[i] != nums[i - 1] ? 1 : 0;
+ }
+ return ans;
+ }
+}
+```
+
+#### C++
+
+```cpp
+class Solution {
+public:
+ int minOperations(vector& nums) {
+ int ans = 0;
+ for (int i = 1; i < nums.size(); ++i) {
+ ans += nums[i] != nums[i - 1];
+ }
+ return ans;
+ }
+};
+```
+
+#### Go
+
+```go
+func minOperations(nums []int) (ans int) {
+ for i, x := range nums[1:] {
+ if x != nums[i] {
+ ans++
+ }
+ }
+ return
+}
+```
+
+#### TypeScript
+
+```ts
+function minOperations(nums: number[]): number {
+ let ans = 0;
+ for (let i = 1; i < nums.length; ++i) {
+ ans += nums[i] !== nums[i - 1] ? 1 : 0;
+ }
+ return ans;
+}
+```
+
+
+
+
+
+
diff --git a/solution/3300-3399/3353.Minimum Total Operations/Solution.cpp b/solution/3300-3399/3353.Minimum Total Operations/Solution.cpp
new file mode 100644
index 0000000000000..6badaaade2203
--- /dev/null
+++ b/solution/3300-3399/3353.Minimum Total Operations/Solution.cpp
@@ -0,0 +1,10 @@
+class Solution {
+public:
+ int minOperations(vector& nums) {
+ int ans = 0;
+ for (int i = 1; i < nums.size(); ++i) {
+ ans += nums[i] != nums[i - 1];
+ }
+ return ans;
+ }
+};
diff --git a/solution/3300-3399/3353.Minimum Total Operations/Solution.go b/solution/3300-3399/3353.Minimum Total Operations/Solution.go
new file mode 100644
index 0000000000000..8bf638b34fd53
--- /dev/null
+++ b/solution/3300-3399/3353.Minimum Total Operations/Solution.go
@@ -0,0 +1,8 @@
+func minOperations(nums []int) (ans int) {
+ for i, x := range nums[1:] {
+ if x != nums[i] {
+ ans++
+ }
+ }
+ return
+}
diff --git a/solution/3300-3399/3353.Minimum Total Operations/Solution.java b/solution/3300-3399/3353.Minimum Total Operations/Solution.java
new file mode 100644
index 0000000000000..209724a94fd5a
--- /dev/null
+++ b/solution/3300-3399/3353.Minimum Total Operations/Solution.java
@@ -0,0 +1,9 @@
+class Solution {
+ public int minOperations(int[] nums) {
+ int ans = 0;
+ for (int i = 1; i < nums.length; ++i) {
+ ans += nums[i] != nums[i - 1] ? 1 : 0;
+ }
+ return ans;
+ }
+}
diff --git a/solution/3300-3399/3353.Minimum Total Operations/Solution.py b/solution/3300-3399/3353.Minimum Total Operations/Solution.py
new file mode 100644
index 0000000000000..63d00803bf1bd
--- /dev/null
+++ b/solution/3300-3399/3353.Minimum Total Operations/Solution.py
@@ -0,0 +1,3 @@
+class Solution:
+ def minOperations(self, nums: List[int]) -> int:
+ return sum(x != y for x, y in pairwise(nums))
diff --git a/solution/3300-3399/3353.Minimum Total Operations/Solution.ts b/solution/3300-3399/3353.Minimum Total Operations/Solution.ts
new file mode 100644
index 0000000000000..86813b2dc99fc
--- /dev/null
+++ b/solution/3300-3399/3353.Minimum Total Operations/Solution.ts
@@ -0,0 +1,7 @@
+function minOperations(nums: number[]): number {
+ let ans = 0;
+ for (let i = 1; i < nums.length; ++i) {
+ ans += nums[i] !== nums[i - 1] ? 1 : 0;
+ }
+ return ans;
+}
diff --git a/solution/README.md b/solution/README.md
index 0b8b2024a1177..96ce1aaddbea2 100644
--- a/solution/README.md
+++ b/solution/README.md
@@ -394,7 +394,7 @@
| 0381 | [O(1) 时间插入、删除和获取随机元素 - 允许重复](/solution/0300-0399/0381.Insert%20Delete%20GetRandom%20O%281%29%20-%20Duplicates%20allowed/README.md) | `设计`,`数组`,`哈希表`,`数学`,`随机化` | 困难 | |
| 0382 | [链表随机节点](/solution/0300-0399/0382.Linked%20List%20Random%20Node/README.md) | `水塘抽样`,`链表`,`数学`,`随机化` | 中等 | |
| 0383 | [赎金信](/solution/0300-0399/0383.Ransom%20Note/README.md) | `哈希表`,`字符串`,`计数` | 简单 | |
-| 0384 | [打乱数组](/solution/0300-0399/0384.Shuffle%20an%20Array/README.md) | `数组`,`数学`,`随机化` | 中等 | |
+| 0384 | [打乱数组](/solution/0300-0399/0384.Shuffle%20an%20Array/README.md) | `设计`,`数组`,`数学`,`随机化` | 中等 | |
| 0385 | [迷你语法分析器](/solution/0300-0399/0385.Mini%20Parser/README.md) | `栈`,`深度优先搜索`,`字符串` | 中等 | |
| 0386 | [字典序排数](/solution/0300-0399/0386.Lexicographical%20Numbers/README.md) | `深度优先搜索`,`字典树` | 中等 | |
| 0387 | [字符串中的第一个唯一字符](/solution/0300-0399/0387.First%20Unique%20Character%20in%20a%20String/README.md) | `队列`,`哈希表`,`字符串`,`计数` | 简单 | |
@@ -787,7 +787,7 @@
| 0774 | [最小化去加油站的最大距离](/solution/0700-0799/0774.Minimize%20Max%20Distance%20to%20Gas%20Station/README.md) | `数组`,`二分查找` | 困难 | 🔒 |
| 0775 | [全局倒置与局部倒置](/solution/0700-0799/0775.Global%20and%20Local%20Inversions/README.md) | `数组`,`数学` | 中等 | |
| 0776 | [拆分二叉搜索树](/solution/0700-0799/0776.Split%20BST/README.md) | `树`,`二叉搜索树`,`递归`,`二叉树` | 中等 | 🔒 |
-| 0777 | [在LR字符串中交换相邻字符](/solution/0700-0799/0777.Swap%20Adjacent%20in%20LR%20String/README.md) | `双指针`,`字符串` | 中等 | |
+| 0777 | [在 LR 字符串中交换相邻字符](/solution/0700-0799/0777.Swap%20Adjacent%20in%20LR%20String/README.md) | `双指针`,`字符串` | 中等 | |
| 0778 | [水位上升的泳池中游泳](/solution/0700-0799/0778.Swim%20in%20Rising%20Water/README.md) | `深度优先搜索`,`广度优先搜索`,`并查集`,`数组`,`二分查找`,`矩阵`,`堆(优先队列)` | 困难 | |
| 0779 | [第K个语法符号](/solution/0700-0799/0779.K-th%20Symbol%20in%20Grammar/README.md) | `位运算`,`递归`,`数学` | 中等 | |
| 0780 | [到达终点](/solution/0700-0799/0780.Reaching%20Points/README.md) | `数学` | 困难 | |
@@ -3363,6 +3363,7 @@
| 3350 | [检测相邻递增子数组 II](/solution/3300-3399/3350.Adjacent%20Increasing%20Subarrays%20Detection%20II/README.md) | `数组`,`二分查找` | 中等 | 第 423 场周赛 |
| 3351 | [好子序列的元素之和](/solution/3300-3399/3351.Sum%20of%20Good%20Subsequences/README.md) | `数组`,`哈希表`,`动态规划` | 困难 | 第 423 场周赛 |
| 3352 | [统计小于 N 的 K 可约简整数](/solution/3300-3399/3352.Count%20K-Reducible%20Numbers%20Less%20Than%20N/README.md) | `数学`,`字符串`,`动态规划`,`组合数学` | 困难 | 第 423 场周赛 |
+| 3353 | [Minimum Total Operations](/solution/3300-3399/3353.Minimum%20Total%20Operations/README.md) | | 简单 | 🔒 |
## 版权
diff --git a/solution/README_EN.md b/solution/README_EN.md
index 102754795d988..5f9c1a3f9f19b 100644
--- a/solution/README_EN.md
+++ b/solution/README_EN.md
@@ -392,7 +392,7 @@ Press Control + F(or Command + F on
| 0381 | [Insert Delete GetRandom O(1) - Duplicates allowed](/solution/0300-0399/0381.Insert%20Delete%20GetRandom%20O%281%29%20-%20Duplicates%20allowed/README_EN.md) | `Design`,`Array`,`Hash Table`,`Math`,`Randomized` | Hard | |
| 0382 | [Linked List Random Node](/solution/0300-0399/0382.Linked%20List%20Random%20Node/README_EN.md) | `Reservoir Sampling`,`Linked List`,`Math`,`Randomized` | Medium | |
| 0383 | [Ransom Note](/solution/0300-0399/0383.Ransom%20Note/README_EN.md) | `Hash Table`,`String`,`Counting` | Easy | |
-| 0384 | [Shuffle an Array](/solution/0300-0399/0384.Shuffle%20an%20Array/README_EN.md) | `Array`,`Math`,`Randomized` | Medium | |
+| 0384 | [Shuffle an Array](/solution/0300-0399/0384.Shuffle%20an%20Array/README_EN.md) | `Design`,`Array`,`Math`,`Randomized` | Medium | |
| 0385 | [Mini Parser](/solution/0300-0399/0385.Mini%20Parser/README_EN.md) | `Stack`,`Depth-First Search`,`String` | Medium | |
| 0386 | [Lexicographical Numbers](/solution/0300-0399/0386.Lexicographical%20Numbers/README_EN.md) | `Depth-First Search`,`Trie` | Medium | |
| 0387 | [First Unique Character in a String](/solution/0300-0399/0387.First%20Unique%20Character%20in%20a%20String/README_EN.md) | `Queue`,`Hash Table`,`String`,`Counting` | Easy | |
@@ -3361,6 +3361,7 @@ Press Control + F(or Command + F on
| 3350 | [Adjacent Increasing Subarrays Detection II](/solution/3300-3399/3350.Adjacent%20Increasing%20Subarrays%20Detection%20II/README_EN.md) | `Array`,`Binary Search` | Medium | Weekly Contest 423 |
| 3351 | [Sum of Good Subsequences](/solution/3300-3399/3351.Sum%20of%20Good%20Subsequences/README_EN.md) | `Array`,`Hash Table`,`Dynamic Programming` | Hard | Weekly Contest 423 |
| 3352 | [Count K-Reducible Numbers Less Than N](/solution/3300-3399/3352.Count%20K-Reducible%20Numbers%20Less%20Than%20N/README_EN.md) | `Math`,`String`,`Dynamic Programming`,`Combinatorics` | Hard | Weekly Contest 423 |
+| 3353 | [Minimum Total Operations](/solution/3300-3399/3353.Minimum%20Total%20Operations/README_EN.md) | | Easy | 🔒 |
## Copyright