From eba8a9ea09446e91ea72a13cc2d5e5b3797cedb6 Mon Sep 17 00:00:00 2001
From: yanglbme Given an integer array Given an integer array You must write an algorithm that runs in Example 2: Explanation: The subarray Note that Example 2: If it is not possible to find such a value for A prime number is a natural number greater than 1 with only two factors, 1 and itself. Example 1: If it is not possible to find such a value for A prime number is a natural number greater than 1 with only two factors, 1 and itself. Example 1: Return the maximum number of operations that can be performed. A subsequence is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters. Example 1:
Input: root = [1,2,3], targetSum = 5
Output: false
-Explanation: There two root-to-leaf paths in the tree:
+Explanation: There are two root-to-leaf paths in the tree:
(1 --> 2): The sum is 3.
(1 --> 3): The sum is 4.
There is no root-to-leaf path with sum = 5.
diff --git a/solution/0400-0499/0442.Find All Duplicates in an Array/README_EN.md b/solution/0400-0499/0442.Find All Duplicates in an Array/README_EN.md
index 3ece71c0a4ce0..013557eeb986e 100644
--- a/solution/0400-0499/0442.Find All Duplicates in an Array/README_EN.md
+++ b/solution/0400-0499/0442.Find All Duplicates in an Array/README_EN.md
@@ -17,7 +17,7 @@ tags:
-
nums
of length n
where all the integers of nums
are in the range [1, n]
and each integer appears once or twice, return an array of all the integers that appears twice.nums
of length n
where all the integers of nums
are in the range [1, n]
and each integer appears at most twice, return an array of all the integers that appears twice.O(n)
time and uses only constant auxiliary space, excluding the space needed to store the output
+
Input: word = "xyzxyzxyzxyz"
Output: 12
diff --git a/solution/3000-3099/3095.Shortest Subarray With OR at Least K I/README_EN.md b/solution/3000-3099/3095.Shortest Subarray With OR at Least K I/README_EN.md
index b61019222153c..8c710f1b490d9 100644
--- a/solution/3000-3099/3095.Shortest Subarray With OR at Least K I/README_EN.md
+++ b/solution/3000-3099/3095.Shortest Subarray With OR at Least K I/README_EN.md
@@ -37,6 +37,8 @@ tags:
[3]
has OR
value of 3
. Hence, we return 1
.[2]
is also a special subarray.ans[i]
that satisfies the condition, then set ans[i] = -1
.ans[i]
that satisfies the condition, then set ans[i] = -1
.2nd
largest size is 3.
表:SeasonStats
++------------------+---------+ +| Column Name | Type | ++------------------+---------+ +| season_id | int | +| team_id | int | +| team_name | varchar | +| matches_played | int | +| wins | int | +| draws | int | +| losses | int | +| goals_for | int | +| goals_against | int | ++------------------+---------+ +(season_id, team_id) 是这张表的唯一主键。 +这张表包含每个赛季中每支球队的赛季 id,队伍 id,队伍名,比赛场次,赢场,平局,输场,进球数 (goals_for),以及失球数 (goals_against)。 ++ +
编写一个解决方案来计算 每个赛季每支球队的积分,净胜球 和 排名。排名应确定如下:
+ +积分如下计算:
+ +3
点得分1
点得分0
点得分净胜球计算如下:goals_for - goals_against
返回结果表以 season_id
升序 排序,然后以 rank
升序 排序,最后以 team_name
升序 排序。
结果格式如下所示。
+ ++ +
示例:
+ +输入:
+ +SeasonStats
表:
++------------+---------+-------------------+----------------+------+-------+--------+-----------+---------------+ +| season_id | team_id | team_name | matches_played | wins | draws | losses | goals_for | goals_against | ++------------+---------+-------------------+----------------+------+-------+--------+-----------+---------------+ +| 2021 | 1 | Manchester City | 38 | 29 | 6 | 3 | 99 | 26 | +| 2021 | 2 | Liverpool | 38 | 28 | 8 | 2 | 94 | 26 | +| 2021 | 3 | Chelsea | 38 | 21 | 11 | 6 | 76 | 33 | +| 2021 | 4 | Tottenham | 38 | 22 | 5 | 11 | 69 | 40 | +| 2021 | 5 | Arsenal | 38 | 22 | 3 | 13 | 61 | 48 | +| 2022 | 1 | Manchester City | 38 | 28 | 5 | 5 | 94 | 33 | +| 2022 | 2 | Arsenal | 38 | 26 | 6 | 6 | 88 | 43 | +| 2022 | 3 | Manchester United | 38 | 23 | 6 | 9 | 58 | 43 | +| 2022 | 4 | Newcastle | 38 | 19 | 14 | 5 | 68 | 33 | +| 2022 | 5 | Liverpool | 38 | 19 | 10 | 9 | 75 | 47 | ++------------+---------+-------------------+----------------+------+-------+--------+-----------+---------------+ ++ +
输出:
+ +++------------+---------+-------------------+--------+-----------------+------+ +| season_id | team_id | team_name | points | goal_difference | rank | ++------------+---------+-------------------+--------+-----------------+------+ +| 2021 | 1 | Manchester City | 93 | 73 | 1 | +| 2021 | 2 | Liverpool | 92 | 68 | 2 | +| 2021 | 3 | Chelsea | 74 | 43 | 3 | +| 2021 | 4 | Tottenham | 71 | 29 | 4 | +| 2021 | 5 | Arsenal | 69 | 13 | 5 | +| 2022 | 1 | Manchester City | 89 | 61 | 1 | +| 2022 | 2 | Arsenal | 84 | 45 | 2 | +| 2022 | 3 | Manchester United | 75 | 15 | 3 | +| 2022 | 4 | Newcastle | 71 | 35 | 4 | +| 2022 | 5 | Liverpool | 67 | 28 | 5 | ++------------+---------+-------------------+--------+-----------------+------+ ++ +
解释:
+ +Table: SeasonStats
++------------------+---------+ +| Column Name | Type | ++------------------+---------+ +| season_id | int | +| team_id | int | +| team_name | varchar | +| matches_played | int | +| wins | int | +| draws | int | +| losses | int | +| goals_for | int | +| goals_against | int | ++------------------+---------+ +(season_id, team_id) is the unique key for this table. +This table contains season id, team id, team name, matches played, wins, draws, losses, goals scored (goals_for), and goals conceded (goals_against) for each team in each season. ++ +
Write a solution to calculate the points, goal difference, and rank for each team in each season. The ranking should be determined as follows:
+ +Points are calculated as follows:
+ +3
points for a win1
point for a draw0
points for a lossGoal difference is calculated as: goals_for - goals_against
Return the result table ordered by season_id
in ascending order, then by rank
in ascending order, and finally by team_name
in ascending order.
The query result format is in the following example.
+ ++
Example:
+ +Input:
+ +SeasonStats
table:
++------------+---------+-------------------+----------------+------+-------+--------+-----------+---------------+ +| season_id | team_id | team_name | matches_played | wins | draws | losses | goals_for | goals_against | ++------------+---------+-------------------+----------------+------+-------+--------+-----------+---------------+ +| 2021 | 1 | Manchester City | 38 | 29 | 6 | 3 | 99 | 26 | +| 2021 | 2 | Liverpool | 38 | 28 | 8 | 2 | 94 | 26 | +| 2021 | 3 | Chelsea | 38 | 21 | 11 | 6 | 76 | 33 | +| 2021 | 4 | Tottenham | 38 | 22 | 5 | 11 | 69 | 40 | +| 2021 | 5 | Arsenal | 38 | 22 | 3 | 13 | 61 | 48 | +| 2022 | 1 | Manchester City | 38 | 28 | 5 | 5 | 94 | 33 | +| 2022 | 2 | Arsenal | 38 | 26 | 6 | 6 | 88 | 43 | +| 2022 | 3 | Manchester United | 38 | 23 | 6 | 9 | 58 | 43 | +| 2022 | 4 | Newcastle | 38 | 19 | 14 | 5 | 68 | 33 | +| 2022 | 5 | Liverpool | 38 | 19 | 10 | 9 | 75 | 47 | ++------------+---------+-------------------+----------------+------+-------+--------+-----------+---------------+ ++ +
Output:
+ +++------------+---------+-------------------+--------+-----------------+------+ +| season_id | team_id | team_name | points | goal_difference | rank | ++------------+---------+-------------------+--------+-----------------+------+ +| 2021 | 1 | Manchester City | 93 | 73 | 1 | +| 2021 | 2 | Liverpool | 92 | 68 | 2 | +| 2021 | 3 | Chelsea | 74 | 43 | 3 | +| 2021 | 4 | Tottenham | 71 | 29 | 4 | +| 2021 | 5 | Arsenal | 69 | 13 | 5 | +| 2022 | 1 | Manchester City | 89 | 61 | 1 | +| 2022 | 2 | Arsenal | 84 | 45 | 2 | +| 2022 | 3 | Manchester United | 75 | 15 | 3 | +| 2022 | 4 | Newcastle | 71 | 35 | 4 | +| 2022 | 5 | Liverpool | 67 | 28 | 5 | ++------------+---------+-------------------+--------+-----------------+------+ ++ +
Explanation:
+ +