From 1135e8d080fd40626025cabffb1f0d75dcacf08a Mon Sep 17 00:00:00 2001 From: acbin <44314231+acbin@users.noreply.github.com> Date: Fri, 17 Nov 2023 08:31:24 +0000 Subject: [PATCH] chore: update lc problems --- .../0000-0099/0027.Remove Element/README.md | 24 ++--- .../0205.Isomorphic Strings/README.md | 6 +- .../0410.Split Array Largest Sum/README.md | 12 +-- .../0489.Robot Room Cleaner/README.md | 81 ++++++++++------ .../0532.K-diff Pairs in an Array/README.md | 2 +- .../0631.Design Excel Sum Formula/README.md | 96 ++++++++++--------- solution/1200-1299/1236.Web Crawler/README.md | 51 +++++----- .../README_EN.md | 2 +- .../2666.Allow One Function Call/README.md | 2 +- .../2881.Create a New Column/README_EN.md | 2 +- .../2922.Market Analysis III/README.md | 14 +-- .../README.md | 2 +- solution/DATABASE_README.md | 2 +- solution/DATABASE_README_EN.md | 2 +- solution/JAVASCRIPT_README.md | 2 +- solution/README.md | 30 +++--- solution/README_EN.md | 28 +++--- solution/javascript-summary.md | 2 +- solution/summary.md | 6 +- 19 files changed, 196 insertions(+), 170 deletions(-) diff --git a/solution/0000-0099/0027.Remove Element/README.md b/solution/0000-0099/0027.Remove Element/README.md index e9d12f9914f38..6a7d8c942e81f 100644 --- a/solution/0000-0099/0027.Remove Element/README.md +++ b/solution/0000-0099/0027.Remove Element/README.md @@ -6,13 +6,13 @@ -
给你一个数组 nums
和一个值 val
,你需要 原地 移除所有数值等于 val
的元素,并返回移除后数组的新长度。
给你一个数组 nums
和一个值 val
,你需要 原地 移除所有数值等于 val
的元素,并返回移除后数组的新长度。
不要使用额外的数组空间,你必须仅使用 O(1)
额外空间并 原地 修改输入数组。
元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。
-+
说明:
@@ -28,37 +28,37 @@ int len = removeElement(nums, val); // 在函数里修改输入数组对于调用者是可见的。 // 根据你的函数返回的长度, 它会打印出数组中 该长度范围内 的所有元素。 -for (int i = 0; i < len; i++) { - print(nums[i]); +for (int i = 0; i < len; i++) { + print(nums[i]); } -+
示例 1:
输入:nums = [3,2,2,3], val = 3
输出:2, nums = [2,2]
-解释:函数应该返回新的长度 2, 并且 nums 中的前两个元素均为 2。你不需要考虑数组中超出新长度后面的元素。例如,函数返回的新长度为 2 ,而 nums = [2,2,3,3] 或 nums = [2,2,0,0],也会被视作正确答案。
+解释:函数应该返回新的长度 2
, 并且 nums 中的前两个元素均为 2。你不需要考虑数组中超出新长度后面的元素。例如,函数返回的新长度为 2 ,而 nums = [2,2,3,3] 或 nums = [2,2,0,0],也会被视作正确答案。
示例 2:
输入:nums = [0,1,2,2,3,0,4,2], val = 2 -输出:5, nums = [0,1,4,0,3] -解释:函数应该返回新的长度-5
, 并且 nums 中的前五个元素为0
,1
,3
,0
, 4。注意这五个元素可为任意顺序。你不需要考虑数组中超出新长度后面的元素。 +输出:5, nums = [0,1,3,0,4] +解释:函数应该返回新的长度5
, 并且 nums 中的前五个元素为0
,1
,3
,0
,4
。注意这五个元素可为任意顺序。你不需要考虑数组中超出新长度后面的元素。
+
提示:
0 <= nums.length <= 100
0 <= nums[i] <= 50
0 <= val <= 100
0 <= nums.length <= 100
0 <= nums[i] <= 50
0 <= val <= 100
示例 1:
-输入:s ="egg",
t ="add"
+输入:s ="egg"
, t ="add"
输出:true
示例 2:
-输入:s ="foo",
t ="bar"
+输入:s ="foo"
, t ="bar"
输出:false
示例 3:
-输入:s ="paper",
t ="title"
+输入:s ="paper"
, t ="title"
输出:true
diff --git a/solution/0400-0499/0410.Split Array Largest Sum/README.md b/solution/0400-0499/0410.Split Array Largest Sum/README.md index 8a5aab9378fc3..565883f1ad2c6 100644 --- a/solution/0400-0499/0410.Split Array Largest Sum/README.md +++ b/solution/0400-0499/0410.Split Array Largest Sum/README.md @@ -6,16 +6,16 @@ -
给定一个非负整数数组 nums
和一个整数 m
,你需要将这个数组分成 m
个非空的连续子数组。
给定一个非负整数数组 nums
和一个整数 k
,你需要将这个数组分成 k
个非空的连续子数组。
设计一个算法使得这 m
个子数组各自和的最大值最小。
设计一个算法使得这 k
个子数组各自和的最大值最小。
示例 1:
-输入:nums = [7,2,5,10,8], m = 2 +输入:nums = [7,2,5,10,8], k = 2 输出:18 解释: 一共有四种方法将 nums 分割为 2 个子数组。 @@ -25,14 +25,14 @@示例 2:
-输入:nums = [1,2,3,4,5], m = 2 +输入:nums = [1,2,3,4,5], k = 2 输出:9示例 3:
-输入:nums = [1,4,4], m = 3 +输入:nums = [1,4,4], k = 3 输出:4@@ -43,7 +43,7 @@
1 <= nums.length <= 1000
0 <= nums[i] <= 106
1 <= m <= min(50, nums.length)
1 <= k <= min(50, nums.length)
房间(用格栅表示)中有一个扫地机器人。格栅中的每一个格子有空和障碍物两种可能。
+房间中的某个位置上有一个机器人,你需要控制它清扫房间。房间被建模为一个 m x n
的二进制网格,其中 0
表示单元格中有障碍物,1
表示空单元格。
扫地机器人提供4个API,可以向前进,向左转或者向右转。每次转弯90度。
+机器人从一个未知的空单元格开始出发,并且你无法访问网格,但你可以使用给定的 API Robot
控制机器人。
当扫地机器人试图进入障碍物格子时,它的碰撞传感器会探测出障碍物,使它停留在原地。
+你的任务是使用机器人清扫整个房间(即清理房间中的每个空单元格)。机器人具有四个给定的API,可以前进、向左转或向右转。每次转弯 90 度。
-请利用提供的4个API编写让机器人清理整个房间的算法。
+当机器人试图移动到一个存在障碍物的单元格时,它的碰撞传感器会检测到障碍物,并停留在当前单元格。
+ +设计一个算法,使用下述 API 清扫整个房间:
interface Robot { - // 若下一个方格为空,则返回true,并移动至该方格 - // 若下一个方格为障碍物,则返回false,并停留在原地 + // 若下一个单元格为空,则返回 true ,并移动至该单元格。 + // 若下一个单元格为障碍物,则返回 false ,并停留在当前单元格。 boolean move(); - // 在调用turnLeft/turnRight后机器人会停留在原位置 - // 每次转弯90度 + // 在调用 turnLeft/turnRight 后机器人会停留在当前单元格。 + // 每次转弯 90 度。 void turnLeft(); void turnRight(); - // 清理所在方格 + // 清理当前单元格。 void clean(); }-
示例:
+注意 扫地机器人的初始方向向上。你可以假定网格的四周都被墙包围。
+ ++ +
自定义测试:
+ +输入只用于初始化房间和机器人的位置。你需要「盲解」这个问题。换而言之,你必须在对房间和机器人位置一无所知的情况下,只使用 4 个给出的 API 解决问题。
+ +-
示例 1:
++输入:room = [[1,1,1,1,1,0,1,1],[1,1,1,1,1,0,1,1],[1,0,1,1,1,1,1,1],[0,0,0,1,0,0,0,0],[1,1,1,1,1,1,1,1]], row = 1, col = 3 +输出:Robot cleaned all rooms. +解释: +房间内的所有单元格用 0 或 1 填充。 +0 表示障碍物,1 表示可以通过。 +机器人从 row=1, col=3 的初始位置出发。 +在左上角的一行以下,三列以右。 ++ +
示例 2:
-输入: -room = [ - [1,1,1,1,1,0,1,1], - [1,1,1,1,1,0,1,1], - [1,0,1,1,1,1,1,1], - [0,0,0,1,0,0,0,0], - [1,1,1,1,1,1,1,1] -], -row = 1, -col = 3 - -解析: -房间格栅用0或1填充。0表示障碍物,1表示可以通过。 -机器人从row=1,col=3的初始位置出发。在左上角的一行以下,三列以右。 +输入:room = [[1]], row = 0, col = 0 +输出:Robot cleaned all rooms.-
注意:
++ +
提示:
+ +m == room.length
n == room[i].length
1 <= m <= 100
1 <= n <= 200
room[i][j]
为 0
或 1
.0 <= row < m
0 <= col < n
room[row][col] == 1
0 <= i, j < nums.length
i != j
nums[i] - nums[j] == k
|nums[i] - nums[j]| == k
注意,|val|
表示 val
的绝对值。
你的任务是实现 Excel 的求和功能,具体的操作如下:
+请你设计 Excel 中的基本功能,并实现求和公式。
-Excel(int H, char W):
这是一个构造函数,输入表明了 Excel 的高度和宽度。H 是一个正整数,范围从 1 到 26,代表高度。W 是一个字符,范围从 'A' 到 'Z',宽度等于从 'A' 到 W 的字母个数。Excel 表格是一个高度 * 宽度的二维整数数组,数组中元素初始化为 0。第一行下标从 1 开始,第一列下标从 'A' 开始。
实现 Excel
类:
- -
void Set(int row, char column, int val):
设置 C(row, column)
中的值为 val。
- -
int Get(int row, char column):
返回 C(row, column)
中的值。
- -
int Sum(int row, char column, List of Strings : numbers):
这个函数会将计算的结果放入 C(row, column)
中,计算的结果等于在 numbers
中代表的所有元素之和,这个函数同时也会将这个结果返回。求和公式会一直计算更新结果直到这个公式被其他的值或者公式覆盖。
numbers
是若干字符串的集合,每个字符串代表单个位置或一个区间。如果这个字符串表示单个位置,它的格式如下:ColRow
,例如 "F7" 表示位置 (7, F) 。如果这个字符串表示一个区间,它的格式如下:ColRow1:ColRow2
。区间就是左上角为 ColRow1 右下角为 ColRow2 的长方形。
Excel(int height, char width)
:用高度 height
和宽度 width
初始化对象。该表格是一个大小为 height x width
的整数矩阵 mat
,其中行下标范围是 [1, height]
,列下标范围是 ['A', width]
。初始情况下,所有的值都应该为 零 。void set(int row, char column, int val)
:将 mat[row][column]
的值更改为 val
。int get(int row, char column)
:返回 mat[row][column]
的值。int sum(int row, char column, List<String> numbers)
:将 mat[row][column]
的值设为由 numbers
表示的单元格的和,并返回 mat[row][column]
的值。此求和公式应该 长期作用于 该单元格,直到该单元格被另一个值或另一个求和公式覆盖。其中,numbers[i]
的格式可以为:
+ "ColRow"
:表示某个单元格。
+ "F7"
表示单元格 mat[7]['F']
。"ColRow1:ColRow2"
:表示一组单元格。该范围将始终为一个矩形,其中 "ColRow1"
表示左上角单元格的位置,"ColRow2"
表示右下角单元格的位置。
+ "B3:F7"
表示 3 <= i <= 7
和 'B' <= j <= 'F'
的单元格 mat[i][j]
。+
注意:可以假设不会出现循环求和引用。
-注意: 你可以认为不会出现循环求和的定义,比如说:mat[1]['A'] == sum(1, "B")
和 mat[1]['B'] == sum(1, "A")
.
mat[1]['A'] == sum(1, "B")
,且 mat[1]['B'] == sum(1, "A")
。+
-
示例 1:
+示例 1:
-输入: -["Excel", "set", "sum", "set", "get"] +输入: +["Excel", "set", "sum", "set", "get"] [[3, "C"], [1, "A", 2], [3, "C", ["A1", "A1:B2"]], [2, "B", 2], [3, "C"]] -输出: +输出: [null, null, 4, null, 6] -解释: +解释: +执行以下操作: Excel excel = new Excel(3, "C"); - // 构造一个 3*3 的二维数组,初始化全是 0。 + // 构造一个 3 * 3 的二维数组,所有值初始化为零。 // A B C // 1 0 0 0 // 2 0 0 0 // 3 0 0 0 excel.set(1, "A", 2); - // 设置 C(1,"A") 为 2。 + // 将 mat[1]["A"] 设置为 2 。 // A B C // 1 2 0 0 // 2 0 0 0 // 3 0 0 0 -excel.sum(3, "C", ["A1", "A1:B2"]); // return 4 - // 将 C(3,"C") 的值设为 C(1,"A") 单点以及左上角为 C(1,"A") 右下角为 C(2,"B") 的长方形两者之和。返回值 4。 +excel.sum(3, "C", ["A1", "A1:B2"]); // 返回 4 + // 将 mat[3]["C"] 设置为 mat[1]["A"] 的值与矩形范围的单元格和的和,该范围的左上角单元格位置为 mat[1]["A"] ,右下角单元格位置为 mat[2]["B"] 。 + // A B C // 1 2 0 0 // 2 0 0 0 // 3 0 0 4 excel.set(2, "B", 2); -// 将 C(2,"B") 设为 2。 注意 C(3, "C") 的值也同时改变。 + // 将 mat[2]["B"] 设置为 2 。注意 mat[3]["C"] 也应该更改。 // A B C // 1 2 0 0 // 2 0 2 0 // 3 0 0 6 -excel.get(3, "C"); // 返回 6+excel.get(3, "C"); // 返回 6 + -
+
-
提示:
+提示:
1 <= height <= 26
'A' <= width <= 'Z'
1 <= row <= height
'A' <= column <= width
-100 <= val <= 100
1 <= numbers.length <= 5
numbers[i]
的格式为 "ColRow"
或 "ColRow1:ColRow2"
.set
, get
, and sum
操作数不超过 100 次1 <= height <= 26
'A' <= width <= 'Z'
1 <= row <= height
'A' <= column <= width
-100 <= val <= 100
1 <= numbers.length <= 5
numbers[i]
的格式为 "ColRow"
或 "ColRow1:ColRow2"
。set
、get
和 sum
进行 100
次调用。- -
- ## 解法 diff --git a/solution/1200-1299/1236.Web Crawler/README.md b/solution/1200-1299/1236.Web Crawler/README.md index 475a8de185968..7565cddadc3b7 100644 --- a/solution/1200-1299/1236.Web Crawler/README.md +++ b/solution/1200-1299/1236.Web Crawler/README.md @@ -17,13 +17,14 @@
startUrl
相同 的链接集合如上所示的一个链接,其域名为 example.org
。简单起见,你可以假设所有的链接都采用 http协议 并没有指定 端口。例如,链接 http://leetcode.com/problems
和 http://leetcode.com/contest
是同一个域名下的,而链接http://example.org/test
和 http://example.com/abc
是不在同一域名下的。
HtmlParser
接口定义如下:
interface HtmlParser { +diff --git a/solution/2900-2999/2927.Distribute Candies Among Children III/README.md b/solution/2900-2999/2927.Distribute Candies Among Children III/README.md index 390c1a0a661f1..6759b894cad96 100644 --- a/solution/2900-2999/2927.Distribute Candies Among Children III/README.md +++ b/solution/2900-2999/2927.Distribute Candies Among Children III/README.md @@ -1,4 +1,4 @@ -# [2927. 将糖果分发给孩子 III](https://leetcode.cn/problems/distribute-candies-among-children-iii) +# [2927. 给小朋友们分糖果 III](https://leetcode.cn/problems/distribute-candies-among-children-iii) [English Version](/solution/2900-2999/2927.Distribute%20Candies%20Among%20Children%20III/README_EN.md) diff --git a/solution/DATABASE_README.md b/solution/DATABASE_README.md index 5e3f2e0111991..c07f1614bd397 100644 --- a/solution/DATABASE_README.md +++ b/solution/DATABASE_README.md @@ -246,7 +246,7 @@ | 2853 | [最高薪水差异](/solution/2800-2899/2853.Highest%20Salaries%20Difference/README.md) | `数据库` | 简单 | 🔒 | | 2854 | [滚动平均步数](/solution/2800-2899/2854.Rolling%20Average%20Steps/README.md) | `数据库` | 中等 | 🔒 | | 2893 | [计算每个区间内的订单](/solution/2800-2899/2893.Calculate%20Orders%20Within%20Each%20Interval/README.md) | `数据库` | 中等 | 🔒 | -| 2922 | [市场分析 III](/solution/2900-2999/2922.Market%20Analysis%20III/README.md) | | 中等 | 🔒 | +| 2922 | [市场分析 III](/solution/2900-2999/2922.Market%20Analysis%20III/README.md) | `数据库` | 中等 | 🔒 | ## 版权 diff --git a/solution/DATABASE_README_EN.md b/solution/DATABASE_README_EN.md index a0c9c24b672ca..aad41ef999334 100644 --- a/solution/DATABASE_README_EN.md +++ b/solution/DATABASE_README_EN.md @@ -244,7 +244,7 @@ Press Control + F(or Command + F on | 2853 | [Highest Salaries Difference](/solution/2800-2899/2853.Highest%20Salaries%20Difference/README_EN.md) | `Database` | Easy | 🔒 | | 2854 | [Rolling Average Steps](/solution/2800-2899/2854.Rolling%20Average%20Steps/README_EN.md) | `Database` | Medium | 🔒 | | 2893 | [Calculate Orders Within Each Interval](/solution/2800-2899/2893.Calculate%20Orders%20Within%20Each%20Interval/README_EN.md) | `Database` | Medium | 🔒 | -| 2922 | [Market Analysis III](/solution/2900-2999/2922.Market%20Analysis%20III/README_EN.md) | | Medium | 🔒 | +| 2922 | [Market Analysis III](/solution/2900-2999/2922.Market%20Analysis%20III/README_EN.md) | `Database` | Medium | 🔒 | ## Copyright diff --git a/solution/JAVASCRIPT_README.md b/solution/JAVASCRIPT_README.md index 3f4d443a91359..e24d9b431fc61 100644 --- a/solution/JAVASCRIPT_README.md +++ b/solution/JAVASCRIPT_README.md @@ -34,7 +34,7 @@ | 2649 | [嵌套数组生成器](/solution/2600-2699/2649.Nested%20Array%20Generator/README.md) | | 中等 | | | 2650 | [设计可取消函数](/solution/2600-2699/2650.Design%20Cancellable%20Function/README.md) | | 困难 | | | 2665 | [计数器 II](/solution/2600-2699/2665.Counter%20II/README.md) | | 简单 | | -| 2666 | [只允许一次函数调用 44](/solution/2600-2699/2666.Allow%20One%20Function%20Call/README.md) | | 简单 | | +| 2666 | [只允许一次函数调用](/solution/2600-2699/2666.Allow%20One%20Function%20Call/README.md) | | 简单 | | | 2667 | [创建 Hello World 函数](/solution/2600-2699/2667.Create%20Hello%20World%20Function/README.md) | | 简单 | | | 2675 | [将对象数组转换为矩阵](/solution/2600-2699/2675.Array%20of%20Objects%20to%20Matrix/README.md) | | 困难 | 🔒 | | 2676 | [节流](/solution/2600-2699/2676.Throttle/README.md) | | 中等 | 🔒 | diff --git a/solution/README.md b/solution/README.md index fd7aaf545d8e3..da6dba31d3d9a 100644 --- a/solution/README.md +++ b/solution/README.md @@ -2676,7 +2676,7 @@ | 2663 | [字典序最小的美丽字符串](/solution/2600-2699/2663.Lexicographically%20Smallest%20Beautiful%20String/README.md) | `贪心`,`字符串` | 困难 | 第 343 场周赛 | | 2664 | [巡逻的骑士](/solution/2600-2699/2664.The%20Knight%E2%80%99s%20Tour/README.md) | `数组`,`回溯`,`矩阵` | 中等 | 🔒 | | 2665 | [计数器 II](/solution/2600-2699/2665.Counter%20II/README.md) | | 简单 | | -| 2666 | [只允许一次函数调用44](/solution/2600-2699/2666.Allow%20One%20Function%20Call/README.md) | | 简单 | | +| 2666 | [只允许一次函数调用](/solution/2600-2699/2666.Allow%20One%20Function%20Call/README.md) | | 简单 | | | 2667 | [创建 Hello World 函数](/solution/2600-2699/2667.Create%20Hello%20World%20Function/README.md) | | 简单 | | | 2668 | [查询员工当前薪水](/solution/2600-2699/2668.Find%20Latest%20Salaries/README.md) | `数据库` | 简单 | 🔒 | | 2669 | [统计 Spotify 排行榜上艺术家出现次数](/solution/2600-2699/2669.Count%20Artist%20Occurrences%20On%20Spotify%20Ranking%20List/README.md) | `数据库` | 简单 | 🔒 | @@ -2932,20 +2932,20 @@ | 2919 | [使数组变美的最小增量运算数](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README.md) | `数组`,`动态规划` | 中等 | 第 369 场周赛 | | 2920 | [收集所有金币可获得的最大积分](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README.md) | `位运算`,`树`,`深度优先搜索`,`数组`,`动态规划` | 困难 | 第 369 场周赛 | | 2921 | [具有递增价格的最大利润三元组 II](/solution/2900-2999/2921.Maximum%20Profitable%20Triplets%20With%20Increasing%20Prices%20II/README.md) | `树状数组`,`数组` | 困难 | 🔒 | -| 2922 | [市场分析 III](/solution/2900-2999/2922.Market%20Analysis%20III/README.md) | | 中等 | 🔒 | -| 2923 | [找到冠军 I](/solution/2900-2999/2923.Find%20Champion%20I/README.md) | | 简单 | 第 370 场周赛 | -| 2924 | [找到冠军 II](/solution/2900-2999/2924.Find%20Champion%20II/README.md) | | 中等 | 第 370 场周赛 | -| 2925 | [在树上执行操作以后得到的最大分数](/solution/2900-2999/2925.Maximum%20Score%20After%20Applying%20Operations%20on%20a%20Tree/README.md) | | 中等 | 第 370 场周赛 | -| 2926 | [平衡子序列的最大和](/solution/2900-2999/2926.Maximum%20Balanced%20Subsequence%20Sum/README.md) | | 困难 | 第 370 场周赛 | -| 2927 | [将糖果分发给孩子 III](/solution/2900-2999/2927.Distribute%20Candies%20Among%20Children%20III/README.md) | | 困难 | 🔒 | -| 2928 | [给小朋友们分糖果 I](/solution/2900-2999/2928.Distribute%20Candies%20Among%20Children%20I/README.md) | | 简单 | 第 117 场双周赛 | -| 2929 | [给小朋友们分糖果 II](/solution/2900-2999/2929.Distribute%20Candies%20Among%20Children%20II/README.md) | | 中等 | 第 117 场双周赛 | -| 2930 | [重新排列后包含指定子字符串的字符串数目](/solution/2900-2999/2930.Number%20of%20Strings%20Which%20Can%20Be%20Rearranged%20to%20Contain%20Substring/README.md) | | 中等 | 第 117 场双周赛 | -| 2931 | [购买物品的最大开销](/solution/2900-2999/2931.Maximum%20Spending%20After%20Buying%20Items/README.md) | | 困难 | 第 117 场双周赛 | -| 2932 | [找出强数对的最大异或值 I](/solution/2900-2999/2932.Maximum%20Strong%20Pair%20XOR%20I/README.md) | | 简单 | 第 371 场周赛 | -| 2933 | [高访问员工](/solution/2900-2999/2933.High-Access%20Employees/README.md) | | 中等 | 第 371 场周赛 | -| 2934 | [最大化数组末位元素的最少操作次数](/solution/2900-2999/2934.Minimum%20Operations%20to%20Maximize%20Last%20Elements%20in%20Arrays/README.md) | | 中等 | 第 371 场周赛 | -| 2935 | [找出强数对的最大异或值 II](/solution/2900-2999/2935.Maximum%20Strong%20Pair%20XOR%20II/README.md) | | 困难 | 第 371 场周赛 | +| 2922 | [市场分析 III](/solution/2900-2999/2922.Market%20Analysis%20III/README.md) | `数据库` | 中等 | 🔒 | +| 2923 | [找到冠军 I](/solution/2900-2999/2923.Find%20Champion%20I/README.md) | `数组`,`矩阵` | 简单 | 第 370 场周赛 | +| 2924 | [找到冠军 II](/solution/2900-2999/2924.Find%20Champion%20II/README.md) | `图` | 中等 | 第 370 场周赛 | +| 2925 | [在树上执行操作以后得到的最大分数](/solution/2900-2999/2925.Maximum%20Score%20After%20Applying%20Operations%20on%20a%20Tree/README.md) | `树`,`深度优先搜索`,`动态规划` | 中等 | 第 370 场周赛 | +| 2926 | [平衡子序列的最大和](/solution/2900-2999/2926.Maximum%20Balanced%20Subsequence%20Sum/README.md) | `树状数组`,`线段树`,`数组`,`二分查找`,`动态规划` | 困难 | 第 370 场周赛 | +| 2927 | [给小朋友们分糖果 III](/solution/2900-2999/2927.Distribute%20Candies%20Among%20Children%20III/README.md) | `数学`,`组合数学` | 困难 | 🔒 | +| 2928 | [给小朋友们分糖果 I](/solution/2900-2999/2928.Distribute%20Candies%20Among%20Children%20I/README.md) | `数学`,`组合数学`,`枚举` | 简单 | 第 117 场双周赛 | +| 2929 | [给小朋友们分糖果 II](/solution/2900-2999/2929.Distribute%20Candies%20Among%20Children%20II/README.md) | `数学`,`组合数学`,`枚举` | 中等 | 第 117 场双周赛 | +| 2930 | [重新排列后包含指定子字符串的字符串数目](/solution/2900-2999/2930.Number%20of%20Strings%20Which%20Can%20Be%20Rearranged%20to%20Contain%20Substring/README.md) | `数学`,`动态规划`,`组合数学` | 中等 | 第 117 场双周赛 | +| 2931 | [购买物品的最大开销](/solution/2900-2999/2931.Maximum%20Spending%20After%20Buying%20Items/README.md) | `贪心`,`数组`,`排序`,`堆(优先队列)` | 困难 | 第 117 场双周赛 | +| 2932 | [找出强数对的最大异或值 I](/solution/2900-2999/2932.Maximum%20Strong%20Pair%20XOR%20I/README.md) | `位运算`,`字典树`,`数组`,`哈希表`,`滑动窗口` | 简单 | 第 371 场周赛 | +| 2933 | [高访问员工](/solution/2900-2999/2933.High-Access%20Employees/README.md) | `数组`,`哈希表`,`字符串`,`排序` | 中等 | 第 371 场周赛 | +| 2934 | [最大化数组末位元素的最少操作次数](/solution/2900-2999/2934.Minimum%20Operations%20to%20Maximize%20Last%20Elements%20in%20Arrays/README.md) | `贪心`,`数组` | 中等 | 第 371 场周赛 | +| 2935 | [找出强数对的最大异或值 II](/solution/2900-2999/2935.Maximum%20Strong%20Pair%20XOR%20II/README.md) | `位运算`,`字典树`,`数组`,`哈希表`,`滑动窗口` | 困难 | 第 371 场周赛 | | 2936 | [Number of Equal Numbers Blocks](/solution/2900-2999/2936.Number%20of%20Equal%20Numbers%20Blocks/README.md) | | 中等 | 🔒 | ## 版权 diff --git a/solution/README_EN.md b/solution/README_EN.md index c87aa714c53aa..46b514126559c 100644 --- a/solution/README_EN.md +++ b/solution/README_EN.md @@ -2930,20 +2930,20 @@ Press Control + F(or Command + F on | 2919 | [Minimum Increment Operations to Make Array Beautiful](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README_EN.md) | `Array`,`Dynamic Programming` | Medium | Weekly Contest 369 | | 2920 | [Maximum Points After Collecting Coins From All Nodes](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README_EN.md) | `Bit Manipulation`,`Tree`,`Depth-First Search`,`Array`,`Dynamic Programming` | Hard | Weekly Contest 369 | | 2921 | [Maximum Profitable Triplets With Increasing Prices II](/solution/2900-2999/2921.Maximum%20Profitable%20Triplets%20With%20Increasing%20Prices%20II/README_EN.md) | `Binary Indexed Tree`,`Array` | Hard | 🔒 | -| 2922 | [Market Analysis III](/solution/2900-2999/2922.Market%20Analysis%20III/README_EN.md) | | Medium | 🔒 | -| 2923 | [Find Champion I](/solution/2900-2999/2923.Find%20Champion%20I/README_EN.md) | | Easy | Weekly Contest 370 | -| 2924 | [Find Champion II](/solution/2900-2999/2924.Find%20Champion%20II/README_EN.md) | | Medium | Weekly Contest 370 | -| 2925 | [Maximum Score After Applying Operations on a Tree](/solution/2900-2999/2925.Maximum%20Score%20After%20Applying%20Operations%20on%20a%20Tree/README_EN.md) | | Medium | Weekly Contest 370 | -| 2926 | [Maximum Balanced Subsequence Sum](/solution/2900-2999/2926.Maximum%20Balanced%20Subsequence%20Sum/README_EN.md) | | Hard | Weekly Contest 370 | -| 2927 | [Distribute Candies Among Children III](/solution/2900-2999/2927.Distribute%20Candies%20Among%20Children%20III/README_EN.md) | | Hard | 🔒 | -| 2928 | [Distribute Candies Among Children I](/solution/2900-2999/2928.Distribute%20Candies%20Among%20Children%20I/README_EN.md) | | Easy | Biweekly Contest 117 | -| 2929 | [Distribute Candies Among Children II](/solution/2900-2999/2929.Distribute%20Candies%20Among%20Children%20II/README_EN.md) | | Medium | Biweekly Contest 117 | -| 2930 | [Number of Strings Which Can Be Rearranged to Contain Substring](/solution/2900-2999/2930.Number%20of%20Strings%20Which%20Can%20Be%20Rearranged%20to%20Contain%20Substring/README_EN.md) | | Medium | Biweekly Contest 117 | -| 2931 | [Maximum Spending After Buying Items](/solution/2900-2999/2931.Maximum%20Spending%20After%20Buying%20Items/README_EN.md) | | Hard | Biweekly Contest 117 | -| 2932 | [Maximum Strong Pair XOR I](/solution/2900-2999/2932.Maximum%20Strong%20Pair%20XOR%20I/README_EN.md) | | Easy | Weekly Contest 371 | -| 2933 | [High-Access Employees](/solution/2900-2999/2933.High-Access%20Employees/README_EN.md) | | Medium | Weekly Contest 371 | -| 2934 | [Minimum Operations to Maximize Last Elements in Arrays](/solution/2900-2999/2934.Minimum%20Operations%20to%20Maximize%20Last%20Elements%20in%20Arrays/README_EN.md) | | Medium | Weekly Contest 371 | -| 2935 | [Maximum Strong Pair XOR II](/solution/2900-2999/2935.Maximum%20Strong%20Pair%20XOR%20II/README_EN.md) | | Hard | Weekly Contest 371 | +| 2922 | [Market Analysis III](/solution/2900-2999/2922.Market%20Analysis%20III/README_EN.md) | `Database` | Medium | 🔒 | +| 2923 | [Find Champion I](/solution/2900-2999/2923.Find%20Champion%20I/README_EN.md) | `Array`,`Matrix` | Easy | Weekly Contest 370 | +| 2924 | [Find Champion II](/solution/2900-2999/2924.Find%20Champion%20II/README_EN.md) | `Graph` | Medium | Weekly Contest 370 | +| 2925 | [Maximum Score After Applying Operations on a Tree](/solution/2900-2999/2925.Maximum%20Score%20After%20Applying%20Operations%20on%20a%20Tree/README_EN.md) | `Tree`,`Depth-First Search`,`Dynamic Programming` | Medium | Weekly Contest 370 | +| 2926 | [Maximum Balanced Subsequence Sum](/solution/2900-2999/2926.Maximum%20Balanced%20Subsequence%20Sum/README_EN.md) | `Binary Indexed Tree`,`Segment Tree`,`Array`,`Binary Search`,`Dynamic Programming` | Hard | Weekly Contest 370 | +| 2927 | [Distribute Candies Among Children III](/solution/2900-2999/2927.Distribute%20Candies%20Among%20Children%20III/README_EN.md) | `Math`,`Combinatorics` | Hard | 🔒 | +| 2928 | [Distribute Candies Among Children I](/solution/2900-2999/2928.Distribute%20Candies%20Among%20Children%20I/README_EN.md) | `Math`,`Combinatorics`,`Enumeration` | Easy | Biweekly Contest 117 | +| 2929 | [Distribute Candies Among Children II](/solution/2900-2999/2929.Distribute%20Candies%20Among%20Children%20II/README_EN.md) | `Math`,`Combinatorics`,`Enumeration` | Medium | Biweekly Contest 117 | +| 2930 | [Number of Strings Which Can Be Rearranged to Contain Substring](/solution/2900-2999/2930.Number%20of%20Strings%20Which%20Can%20Be%20Rearranged%20to%20Contain%20Substring/README_EN.md) | `Math`,`Dynamic Programming`,`Combinatorics` | Medium | Biweekly Contest 117 | +| 2931 | [Maximum Spending After Buying Items](/solution/2900-2999/2931.Maximum%20Spending%20After%20Buying%20Items/README_EN.md) | `Greedy`,`Array`,`Sorting`,`Heap (Priority Queue)` | Hard | Biweekly Contest 117 | +| 2932 | [Maximum Strong Pair XOR I](/solution/2900-2999/2932.Maximum%20Strong%20Pair%20XOR%20I/README_EN.md) | `Bit Manipulation`,`Trie`,`Array`,`Hash Table`,`Sliding Window` | Easy | Weekly Contest 371 | +| 2933 | [High-Access Employees](/solution/2900-2999/2933.High-Access%20Employees/README_EN.md) | `Array`,`Hash Table`,`String`,`Sorting` | Medium | Weekly Contest 371 | +| 2934 | [Minimum Operations to Maximize Last Elements in Arrays](/solution/2900-2999/2934.Minimum%20Operations%20to%20Maximize%20Last%20Elements%20in%20Arrays/README_EN.md) | `Greedy`,`Array` | Medium | Weekly Contest 371 | +| 2935 | [Maximum Strong Pair XOR II](/solution/2900-2999/2935.Maximum%20Strong%20Pair%20XOR%20II/README_EN.md) | `Bit Manipulation`,`Trie`,`Array`,`Hash Table`,`Sliding Window` | Hard | Weekly Contest 371 | | 2936 | [Number of Equal Numbers Blocks](/solution/2900-2999/2936.Number%20of%20Equal%20Numbers%20Blocks/README_EN.md) | | Medium | 🔒 | ## Copyright diff --git a/solution/javascript-summary.md b/solution/javascript-summary.md index 55e6891c468f4..85429c59a6476 100644 --- a/solution/javascript-summary.md +++ b/solution/javascript-summary.md @@ -24,7 +24,7 @@ - [2649.嵌套数组生成器](/javascript-solution/2600-2699/2649.Nested%20Array%20Generator/README.md) - [2650.设计可取消函数](/javascript-solution/2600-2699/2650.Design%20Cancellable%20Function/README.md) - [2665.计数器 II](/javascript-solution/2600-2699/2665.Counter%20II/README.md) - - [2666.只允许一次函数调用 44](/javascript-solution/2600-2699/2666.Allow%20One%20Function%20Call/README.md) + - [2666.只允许一次函数调用](/javascript-solution/2600-2699/2666.Allow%20One%20Function%20Call/README.md) - [2667.创建 Hello World 函数](/javascript-solution/2600-2699/2667.Create%20Hello%20World%20Function/README.md) - [2675.将对象数组转换为矩阵](/javascript-solution/2600-2699/2675.Array%20of%20Objects%20to%20Matrix/README.md) - [2676.节流](/javascript-solution/2600-2699/2676.Throttle/README.md) diff --git a/solution/summary.md b/solution/summary.md index bee681dbb53ce..b94f1adf67664 100644 --- a/solution/summary.md +++ b/solution/summary.md @@ -402,7 +402,7 @@ - [0394.字符串解码](/solution/0300-0399/0394.Decode%20String/README.md) - [0395.至少有 K 个重复字符的最长子串](/solution/0300-0399/0395.Longest%20Substring%20with%20At%20Least%20K%20Repeating%20Characters/README.md) - [0396.旋转函数](/solution/0300-0399/0396.Rotate%20Function/README.md) - - [0397.整数替换](/solution/0300-0399/0397.Integer%20Replacement/README.md) + - [0397.Integer Replacement](/solution/0300-0399/0397.Integer%20Replacement/README.md) - [0398.随机数索引](/solution/0300-0399/0398.Random%20Pick%20Index/README.md) - [0399.除法求值](/solution/0300-0399/0399.Evaluate%20Division/README.md) @@ -2717,7 +2717,7 @@ - [2663.字典序最小的美丽字符串](/solution/2600-2699/2663.Lexicographically%20Smallest%20Beautiful%20String/README.md) - [2664.巡逻的骑士](/solution/2600-2699/2664.The%20Knight%E2%80%99s%20Tour/README.md) - [2665.计数器 II](/solution/2600-2699/2665.Counter%20II/README.md) - - [2666.只允许一次函数调用44](/solution/2600-2699/2666.Allow%20One%20Function%20Call/README.md) + - [2666.只允许一次函数调用](/solution/2600-2699/2666.Allow%20One%20Function%20Call/README.md) - [2667.创建 Hello World 函数](/solution/2600-2699/2667.Create%20Hello%20World%20Function/README.md) - [2668.查询员工当前薪水](/solution/2600-2699/2668.Find%20Latest%20Salaries/README.md) - [2669.统计 Spotify 排行榜上艺术家出现次数](/solution/2600-2699/2669.Count%20Artist%20Occurrences%20On%20Spotify%20Ranking%20List/README.md) @@ -2984,7 +2984,7 @@ - [2924.找到冠军 II](/solution/2900-2999/2924.Find%20Champion%20II/README.md) - [2925.在树上执行操作以后得到的最大分数](/solution/2900-2999/2925.Maximum%20Score%20After%20Applying%20Operations%20on%20a%20Tree/README.md) - [2926.平衡子序列的最大和](/solution/2900-2999/2926.Maximum%20Balanced%20Subsequence%20Sum/README.md) - - [2927.将糖果分发给孩子 III](/solution/2900-2999/2927.Distribute%20Candies%20Among%20Children%20III/README.md) + - [2927.给小朋友们分糖果 III](/solution/2900-2999/2927.Distribute%20Candies%20Among%20Children%20III/README.md) - [2928.给小朋友们分糖果 I](/solution/2900-2999/2928.Distribute%20Candies%20Among%20Children%20I/README.md) - [2929.给小朋友们分糖果 II](/solution/2900-2999/2929.Distribute%20Candies%20Among%20Children%20II/README.md) - [2930.重新排列后包含指定子字符串的字符串数目](/solution/2900-2999/2930.Number%20of%20Strings%20Which%20Can%20Be%20Rearranged%20to%20Contain%20Substring/README.md)+interface HtmlParser { // 返回给定 url 对应的页面中的全部 url 。 public List<String> getUrls(String url); }@@ -34,40 +35,42 @@示例 1:
-+
-
输入: ++输入: urls = [ - "http://news.yahoo.com", - "http://news.yahoo.com/news", - "http://news.yahoo.com/news/topics/", - "http://news.google.com", - "http://news.yahoo.com/us" + "http://news.yahoo.com", + "http://news.yahoo.com/news", + "http://news.yahoo.com/news/topics/", + "http://news.google.com", + "http://news.yahoo.com/us" ] edges = [[2,0],[2,1],[3,2],[3,1],[0,4]] -startUrl = "http://news.yahoo.com/news/topics/" +startUrl = "http://news.yahoo.com/news/topics/" 输出:[ - "http://news.yahoo.com", - "http://news.yahoo.com/news", - "http://news.yahoo.com/news/topics/", - "http://news.yahoo.com/us" + "http://news.yahoo.com", + "http://news.yahoo.com/news", + "http://news.yahoo.com/news/topics/", + "http://news.yahoo.com/us" ]示例 2:
-+
-
输入: ++输入: urls = [ - "http://news.yahoo.com", - "http://news.yahoo.com/news", - "http://news.yahoo.com/news/topics/", - "http://news.google.com" + "http://news.yahoo.com", + "http://news.yahoo.com/news", + "http://news.yahoo.com/news/topics/", + "http://news.google.com" ] edges = [[0,2],[2,1],[3,2],[3,1],[3,0]] -startUrl = "http://news.google.com" -输入:["http://news.google.com"] +startUrl = "http://news.google.com" +输出:["http://news.google.com"] 解释:startUrl 链接到所有其他不共享相同主机名的页面。@@ -78,8 +81,8 @@ startUrl = "http://news.google.com"
1 <= urls.length <= 1000
1 <= urls[i].length <= 300
- startUrl
为urls
中的一个。域名标签的长为1到63个字符(包括点),只能包含从‘a’到‘z’的ASCII字母、‘0’到‘9’的数字以及连字符即减号(‘-’)。 -域名标签不会以连字符即减号(‘-’)开头或结尾。 +域名标签的长为1到63个字符(包括点),只能包含从‘a’到‘z’的ASCII字母、‘0’到‘9’的数字以及连字符即减号(‘-’)。 +域名标签不会以连字符即减号(‘-’)开头或结尾。 关于域名有效性的约束可参考: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames 你可以假定url库中不包含重复项。 diff --git a/solution/1900-1999/1921.Eliminate Maximum Number of Monsters/README_EN.md b/solution/1900-1999/1921.Eliminate Maximum Number of Monsters/README_EN.md index 5925a752b540b..6a1f55a2a142f 100644 --- a/solution/1900-1999/1921.Eliminate Maximum Number of Monsters/README_EN.md +++ b/solution/1900-1999/1921.Eliminate Maximum Number of Monsters/README_EN.md @@ -23,7 +23,7 @@ Explanation: In the beginning, the distances of the monsters are [1,3,4]. You eliminate the first monster. After a minute, the distances of the monsters are [X,2,3]. You eliminate the second monster. -After a minute, the distances of the monsters are [X,X,2]. You eliminate the thrid monster. +After a minute, the distances of the monsters are [X,X,2]. You eliminate the third monster. All 3 monsters can be eliminated.Example 2:
diff --git a/solution/2600-2699/2666.Allow One Function Call/README.md b/solution/2600-2699/2666.Allow One Function Call/README.md index 3101b8143c743..19c5f0df9d098 100644 --- a/solution/2600-2699/2666.Allow One Function Call/README.md +++ b/solution/2600-2699/2666.Allow One Function Call/README.md @@ -1,4 +1,4 @@ -# [2666. 只允许一次函数调用 44](https://leetcode.cn/problems/allow-one-function-call) +# [2666. 只允许一次函数调用](https://leetcode.cn/problems/allow-one-function-call) [English Version](/solution/2600-2699/2666.Allow%20One%20Function%20Call/README_EN.md) diff --git a/solution/2800-2899/2881.Create a New Column/README_EN.md b/solution/2800-2899/2881.Create a New Column/README_EN.md index 97989d19396bd..11d738329f185 100644 --- a/solution/2800-2899/2881.Create a New Column/README_EN.md +++ b/solution/2800-2899/2881.Create a New Column/README_EN.md @@ -43,7 +43,7 @@ DataFrame employees | Piper | 4548 | 9096 | | Grace | 28150 | 56300 | | Georgia | 1103 | 2206 | -| Willow | 593 | 13186 | +| Willow | 6593 | 13186 | | Finn | 74576 | 149152 | | Thomas | 24433 | 48866 | +---------+--------+--------+ diff --git a/solution/2900-2999/2922.Market Analysis III/README.md b/solution/2900-2999/2922.Market Analysis III/README.md index a01a8c5c08ce0..4ea7e1d6cc868 100644 --- a/solution/2900-2999/2922.Market Analysis III/README.md +++ b/solution/2900-2999/2922.Market Analysis III/README.md @@ -6,7 +6,7 @@ -Table:
+Users
表:
Users
+----------------+---------+ @@ -17,10 +17,10 @@ | favorite_brand | varchar | +----------------+---------+ seller_id 是该表的主键。 -该表包含销售者的 ID, 加入日期以及最喜欢的品牌。 +该表包含卖家的 ID, 加入日期以及最喜欢的品牌。-Table:
+Items
表:
Items
+---------------+---------+ @@ -32,7 +32,7 @@ seller_id 是该表的主键。 item_id 是该表的主键。 该表包含商品 ID 和商品品牌。-Table:
+Orders
表:
Orders
+---------------+---------+ @@ -48,7 +48,7 @@ item_id 是指向 Items 表的外键。 seller_id 是指向 Users 表的外键。 该表包含订单 ID、下单日期、商品 ID 和卖家 ID。-编写一个解决方案,找到销售最多与其最喜欢的品牌 不同 的 独特 商品的 顶级卖家。如果有多个卖家销售同样数量的商品,则返回所有这些卖家。
+编写一个解决方案,找到卖出非喜爱的品牌数量 最多 的一个卖家。如果有多个卖家销售了同样数量的商品,则返回包括所有卖出非喜爱品牌数量最多的卖家名单。
返回按
@@ -95,8 +95,8 @@ Items table: | 3 | 1 | +-----------+-----------+ 解释: -- 卖家 ID 为 2 的用户销售了三件商品,但只有两件不被标记为最喜欢的商品。我们将只列入独特计数为 1,因为这两件商品都是相同的。 -- 卖家 ID 为 3 的用户销售了两件商品,但只有一件不被标记为最喜欢的商品。我们将只包括那个不被标记为最喜欢的商品列入计数中。 +- 卖家 ID 为 2 的用户销售了三件商品,但只有两件不是他最喜欢的商品。由于这两个商品品牌相同,所以我们只计数 1。 +- 卖家 ID 为 3 的用户销售了两件商品,但只有一件不是他最喜欢的商品。我们将只把 不被标记为最喜欢 的商品列入计数中。 因为卖家 ID 为 2 和 3 的卖家都有一件商品列入计数,所以他们都将显示在输出中。seller_id
升序排序 的结果表。