diff --git a/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/README.md b/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/README.md index e13927dcf72ac..153db709eae83 100644 --- a/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/README.md +++ b/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/README.md @@ -201,6 +201,47 @@ function maximumLength(nums: number[]): number { } ``` +#### Rust + +```rust +impl Solution { + pub fn maximum_length(nums: Vec) -> i32 { + let mut f = [[0; 2]; 2]; + let mut ans = 0; + for x in nums { + let x = (x % 2) as usize; + for j in 0..2 { + let y = ((j + 2 - x) % 2) as usize; + f[x][y] = f[y][x] + 1; + ans = ans.max(f[x][y]); + } + } + ans + } +} +``` + +#### C# + +```cs +public class Solution { + public int MaximumLength(int[] nums) { + int k = 2; + int[,] f = new int[k, k]; + int ans = 0; + foreach (int num in nums) { + int x = num % k; + for (int j = 0; j < k; ++j) { + int y = (j - x + k) % k; + f[x, y] = f[y, x] + 1; + ans = Math.Max(ans, f[x, y]); + } + } + return ans; + } +} +``` + diff --git a/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/README_EN.md b/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/README_EN.md index 44454ee1cdb72..819b46e60ccfd 100644 --- a/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/README_EN.md +++ b/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/README_EN.md @@ -199,6 +199,47 @@ function maximumLength(nums: number[]): number { } ``` +#### Rust + +```rust +impl Solution { + pub fn maximum_length(nums: Vec) -> i32 { + let mut f = [[0; 2]; 2]; + let mut ans = 0; + for x in nums { + let x = (x % 2) as usize; + for j in 0..2 { + let y = ((j + 2 - x) % 2) as usize; + f[x][y] = f[y][x] + 1; + ans = ans.max(f[x][y]); + } + } + ans + } +} +``` + +#### C# + +```cs +public class Solution { + public int MaximumLength(int[] nums) { + int k = 2; + int[,] f = new int[k, k]; + int ans = 0; + foreach (int num in nums) { + int x = num % k; + for (int j = 0; j < k; ++j) { + int y = (j - x + k) % k; + f[x, y] = f[y, x] + 1; + ans = Math.Max(ans, f[x, y]); + } + } + return ans; + } +} +``` + diff --git a/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/Solution.cs b/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/Solution.cs new file mode 100644 index 0000000000000..d391801e95d9b --- /dev/null +++ b/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/Solution.cs @@ -0,0 +1,16 @@ +public class Solution { + public int MaximumLength(int[] nums) { + int k = 2; + int[,] f = new int[k, k]; + int ans = 0; + foreach (int num in nums) { + int x = num % k; + for (int j = 0; j < k; ++j) { + int y = (j - x + k) % k; + f[x, y] = f[y, x] + 1; + ans = Math.Max(ans, f[x, y]); + } + } + return ans; + } +} diff --git a/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/Solution.rs b/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/Solution.rs new file mode 100644 index 0000000000000..9cc1b38f2df8f --- /dev/null +++ b/solution/3200-3299/3201.Find the Maximum Length of Valid Subsequence I/Solution.rs @@ -0,0 +1,15 @@ +impl Solution { + pub fn maximum_length(nums: Vec) -> i32 { + let mut f = [[0; 2]; 2]; + let mut ans = 0; + for x in nums { + let x = (x % 2) as usize; + for j in 0..2 { + let y = ((j + 2 - x) % 2) as usize; + f[x][y] = f[y][x] + 1; + ans = ans.max(f[x][y]); + } + } + ans + } +} diff --git a/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/README.md b/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/README.md index 46d2c442bb8f2..cc6fcf8b4ef64 100644 --- a/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/README.md +++ b/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/README.md @@ -178,6 +178,47 @@ function maximumLength(nums: number[], k: number): number { } ``` +#### Rust + +```rust +impl Solution { + pub fn maximum_length(nums: Vec, k: i32) -> i32 { + let k = k as usize; + let mut f = vec![vec![0; k]; k]; + let mut ans = 0; + for x in nums { + let x = (x % k as i32) as usize; + for j in 0..k { + let y = (j + k - x) % k; + f[x][y] = f[y][x] + 1; + ans = ans.max(f[x][y]); + } + } + ans + } +} +``` + +#### C# + +```cs +public class Solution { + public int MaximumLength(int[] nums, int k) { + int[,] f = new int[k, k]; + int ans = 0; + foreach (int num in nums) { + int x = num % k; + for (int j = 0; j < k; ++j) { + int y = (j - x + k) % k; + f[x, y] = f[y, x] + 1; + ans = Math.Max(ans, f[x, y]); + } + } + return ans; + } +} +``` + diff --git a/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/README_EN.md b/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/README_EN.md index d95fb4e4de202..82eaa84903fbc 100644 --- a/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/README_EN.md +++ b/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/README_EN.md @@ -177,6 +177,47 @@ function maximumLength(nums: number[], k: number): number { } ``` +#### Rust + +```rust +impl Solution { + pub fn maximum_length(nums: Vec, k: i32) -> i32 { + let k = k as usize; + let mut f = vec![vec![0; k]; k]; + let mut ans = 0; + for x in nums { + let x = (x % k as i32) as usize; + for j in 0..k { + let y = (j + k - x) % k; + f[x][y] = f[y][x] + 1; + ans = ans.max(f[x][y]); + } + } + ans + } +} +``` + +#### C# + +```cs +public class Solution { + public int MaximumLength(int[] nums, int k) { + int[,] f = new int[k, k]; + int ans = 0; + foreach (int num in nums) { + int x = num % k; + for (int j = 0; j < k; ++j) { + int y = (j - x + k) % k; + f[x, y] = f[y, x] + 1; + ans = Math.Max(ans, f[x, y]); + } + } + return ans; + } +} +``` + diff --git a/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/Solution.cs b/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/Solution.cs new file mode 100644 index 0000000000000..0aa0f6eeaa583 --- /dev/null +++ b/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/Solution.cs @@ -0,0 +1,15 @@ +public class Solution { + public int MaximumLength(int[] nums, int k) { + int[,] f = new int[k, k]; + int ans = 0; + foreach (int num in nums) { + int x = num % k; + for (int j = 0; j < k; ++j) { + int y = (j - x + k) % k; + f[x, y] = f[y, x] + 1; + ans = Math.Max(ans, f[x, y]); + } + } + return ans; + } +} diff --git a/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/Solution.rs b/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/Solution.rs new file mode 100644 index 0000000000000..5b5f5c1822b3d --- /dev/null +++ b/solution/3200-3299/3202.Find the Maximum Length of Valid Subsequence II/Solution.rs @@ -0,0 +1,16 @@ +impl Solution { + pub fn maximum_length(nums: Vec, k: i32) -> i32 { + let k = k as usize; + let mut f = vec![vec![0; k]; k]; + let mut ans = 0; + for x in nums { + let x = (x % k as i32) as usize; + for j in 0..k { + let y = (j + k - x) % k; + f[x][y] = f[y][x] + 1; + ans = ans.max(f[x][y]); + } + } + ans + } +} diff --git a/solution/3600-3699/3603.Minimum Cost Path with Alternating Directions II/README.md b/solution/3600-3699/3603.Minimum Cost Path with Alternating Directions II/README.md index 96928cc3abff5..fd109a0678bf3 100644 --- a/solution/3600-3699/3603.Minimum Cost Path with Alternating Directions II/README.md +++ b/solution/3600-3699/3603.Minimum Cost Path with Alternating Directions II/README.md @@ -24,13 +24,13 @@ tags:

另外给你一个二维整数数组 waitCost,其中 waitCost[i][j] 定义了在该单元格 等待 的成本。

-

你从第 1 秒开始在单元格 (0, 0)

+

路径始终从第 1 步进入单元格 (0, 0) 并支付入场花费开始。

每一步,你都遵循交替模式:

  • 在 奇数秒 ,你必须向 右 或向 下 移动到 相邻 的单元格,并支付其进入成本。
  • -
  • 在 偶数秒 ,你必须原地 等待 ,并支付 waitCost[i][j]
  • +
  • 在 偶数秒 ,你必须原地 等待恰好 1 秒并在 1 秒期间支付 waitCost[i][j]

返回到达 (m - 1, n - 1) 所需的 最小 总成本。

diff --git a/solution/3600-3699/3603.Minimum Cost Path with Alternating Directions II/README_EN.md b/solution/3600-3699/3603.Minimum Cost Path with Alternating Directions II/README_EN.md index 9a8bf0a39489e..9f20ea6c27b10 100644 --- a/solution/3600-3699/3603.Minimum Cost Path with Alternating Directions II/README_EN.md +++ b/solution/3600-3699/3603.Minimum Cost Path with Alternating Directions II/README_EN.md @@ -24,13 +24,13 @@ tags:

You are also given a 2D integer array waitCost where waitCost[i][j] defines the cost to wait on that cell.

-

You start at cell (0, 0) at second 1.

+

The path will always begin by entering cell (0, 0) on move 1 and paying the entrance cost.

At each step, you follow an alternating pattern:

  • On odd-numbered seconds, you must move right or down to an adjacent cell, paying its entry cost.
  • -
  • On even-numbered seconds, you must wait in place, paying waitCost[i][j].
  • +
  • On even-numbered seconds, you must wait in place for exactly one second and pay waitCost[i][j] during that second.

Return the minimum total cost required to reach (m - 1, n - 1).

diff --git a/solution/3600-3699/3612.Process String with Special Operations I/README.md b/solution/3600-3699/3612.Process String with Special Operations I/README.md index bb811dc19670e..f22e21bd611d7 100644 --- a/solution/3600-3699/3612.Process String with Special Operations I/README.md +++ b/solution/3600-3699/3612.Process String with Special Operations I/README.md @@ -2,6 +2,9 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3612.Process%20String%20with%20Special%20Operations%20I/README.md +tags: + - 字符串 + - 模拟 --- diff --git a/solution/3600-3699/3612.Process String with Special Operations I/README_EN.md b/solution/3600-3699/3612.Process String with Special Operations I/README_EN.md index f605677db4b72..e359d28d3f342 100644 --- a/solution/3600-3699/3612.Process String with Special Operations I/README_EN.md +++ b/solution/3600-3699/3612.Process String with Special Operations I/README_EN.md @@ -2,6 +2,9 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3612.Process%20String%20with%20Special%20Operations%20I/README_EN.md +tags: + - String + - Simulation --- diff --git a/solution/3600-3699/3613.Minimize Maximum Component Cost/README.md b/solution/3600-3699/3613.Minimize Maximum Component Cost/README.md index 053cac536a4f1..05d255ccff0d8 100644 --- a/solution/3600-3699/3613.Minimize Maximum Component Cost/README.md +++ b/solution/3600-3699/3613.Minimize Maximum Component Cost/README.md @@ -2,6 +2,11 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3613.Minimize%20Maximum%20Component%20Cost/README.md +tags: + - 排序 + - 并查集 + - 图 + - 二分查找 --- diff --git a/solution/3600-3699/3613.Minimize Maximum Component Cost/README_EN.md b/solution/3600-3699/3613.Minimize Maximum Component Cost/README_EN.md index 0ecce456b455e..444b4888373c3 100644 --- a/solution/3600-3699/3613.Minimize Maximum Component Cost/README_EN.md +++ b/solution/3600-3699/3613.Minimize Maximum Component Cost/README_EN.md @@ -2,6 +2,11 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3613.Minimize%20Maximum%20Component%20Cost/README_EN.md +tags: + - Sort + - Union Find + - Graph + - Binary Search --- diff --git a/solution/3600-3699/3614.Process String with Special Operations II/README.md b/solution/3600-3699/3614.Process String with Special Operations II/README.md index 88818f9f69d38..e81dc8614a26a 100644 --- a/solution/3600-3699/3614.Process String with Special Operations II/README.md +++ b/solution/3600-3699/3614.Process String with Special Operations II/README.md @@ -2,6 +2,9 @@ comments: true difficulty: 困难 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3614.Process%20String%20with%20Special%20Operations%20II/README.md +tags: + - 字符串 + - 模拟 --- diff --git a/solution/3600-3699/3614.Process String with Special Operations II/README_EN.md b/solution/3600-3699/3614.Process String with Special Operations II/README_EN.md index 488c750466ce9..e1d16471a65cc 100644 --- a/solution/3600-3699/3614.Process String with Special Operations II/README_EN.md +++ b/solution/3600-3699/3614.Process String with Special Operations II/README_EN.md @@ -2,6 +2,9 @@ comments: true difficulty: Hard edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3614.Process%20String%20with%20Special%20Operations%20II/README_EN.md +tags: + - String + - Simulation --- diff --git a/solution/3600-3699/3615.Longest Palindromic Path in Graph/README.md b/solution/3600-3699/3615.Longest Palindromic Path in Graph/README.md index cc7ff902383d2..dcacd57e6bd61 100644 --- a/solution/3600-3699/3615.Longest Palindromic Path in Graph/README.md +++ b/solution/3600-3699/3615.Longest Palindromic Path in Graph/README.md @@ -2,6 +2,11 @@ comments: true difficulty: 困难 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3615.Longest%20Palindromic%20Path%20in%20Graph/README.md +tags: + - 位运算 + - 图 + - 字符串 + - 动态规划 --- diff --git a/solution/3600-3699/3615.Longest Palindromic Path in Graph/README_EN.md b/solution/3600-3699/3615.Longest Palindromic Path in Graph/README_EN.md index 4e8642d6a1485..bad7ca4582bcd 100644 --- a/solution/3600-3699/3615.Longest Palindromic Path in Graph/README_EN.md +++ b/solution/3600-3699/3615.Longest Palindromic Path in Graph/README_EN.md @@ -2,6 +2,11 @@ comments: true difficulty: Hard edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3615.Longest%20Palindromic%20Path%20in%20Graph/README_EN.md +tags: + - Bit Manipulation + - Graph + - String + - Dynamic Programming --- diff --git a/solution/3600-3699/3616.Number of Student Replacements/README.md b/solution/3600-3699/3616.Number of Student Replacements/README.md index 1bbd5d5ee7a70..a17a8ab749245 100644 --- a/solution/3600-3699/3616.Number of Student Replacements/README.md +++ b/solution/3600-3699/3616.Number of Student Replacements/README.md @@ -6,7 +6,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3616.Nu -# [3616. Number of Student Replacements 🔒](https://leetcode.cn/problems/number-of-student-replacements) +# [3616. 学生替换人数 🔒](https://leetcode.cn/problems/number-of-student-replacements) [English Version](/solution/3600-3699/3616.Number%20of%20Student%20Replacements/README_EN.md) @@ -14,53 +14,55 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3616.Nu -

You are given an integer array ranks where ranks[i] represents the rank of the ith student arriving in order. A lower number indicates a better rank.

+

给定一个整数数组 ranks,其中 ranks[i] 表示第 i按顺序 到达的学生排名。数字越低表示排名 越好

-

Initially, the first student is selected by default.

+

最初,默认 选中 第一个学生。

-

A replacement occurs when a student with a strictly better rank arrives and replaces the current selection.

+

当一名排名 严格 更好的学生到来时,会发生 替换,并 取代 当前的选择。

-

Return the total number of replacements made.

+

返回替换的总数。

 

-

Example 1:

+ +

示例 1:

-

Input: ranks = [4,1,2]

+

输入:ranks = [4,1,2]

-

Output: 1

+

输出:1

-

Explanation:

+

解释:

    -
  • The first student with ranks[0] = 4 is initially selected.
  • -
  • The second student with ranks[1] = 1 is better than the current selection, so a replacement occurs.
  • -
  • The third student has a worse rank, so no replacement occurs.
  • -
  • Thus, the number of replacements is 1.
  • +
  • 第一个 ranks[0] = 4 的学生最初被选中。
  • +
  • 第二个学生 ranks[1] = 1 比当前选择更好,因此发生替换。
  • +
  • 第三名学生排名更差,因此没有发生替换。
  • +
  • 因此,替换的人数为 1。
-

Example 2:

+

示例 2:

-

Input: ranks = [2,2,3]

+

输入:ranks = [2,2,3]

-

Output: 0

+

输出:0

-

Explanation:

+

解释:

    -
  • The first student with ranks[0] = 2 is initially selected.
  • -
  • Neither of ranks[1] = 2 or ranks[2] = 3 is better than the current selection.
  • -
  • Thus, the number of replacements is 0.
  • +
  • 第一个 ranks[0] = 2 的学生最初被选中。
  • +
  • 两个 ranks[1] = 2 或 ranks[2] = 3 都不如当前选择好。
  • +
  • 因此,替换的人数为 0。

 

-

Constraints:

+ +

提示:

    -
  • 1 <= ranks.length <= 105​​​​​​​
  • +
  • 1 <= ranks.length <= 105
  • 1 <= ranks[i] <= 105
diff --git a/solution/3600-3699/3617.Find Students with Study Spiral Pattern/README.md b/solution/3600-3699/3617.Find Students with Study Spiral Pattern/README.md index 9ece3baa11e91..5c3be950e6467 100644 --- a/solution/3600-3699/3617.Find Students with Study Spiral Pattern/README.md +++ b/solution/3600-3699/3617.Find Students with Study Spiral Pattern/README.md @@ -8,7 +8,7 @@ tags: -# [3617. Find Students with Study Spiral Pattern](https://leetcode.cn/problems/find-students-with-study-spiral-pattern) +# [3617. 查找具有螺旋学习模式的学生](https://leetcode.cn/problems/find-students-with-study-spiral-pattern) [English Version](/solution/3600-3699/3617.Find%20Students%20with%20Study%20Spiral%20Pattern/README_EN.md) @@ -16,7 +16,7 @@ tags: -

Table: students

+

表:students

 +--------------+---------+
@@ -26,11 +26,11 @@ tags:
 | student_name | varchar |
 | major        | varchar |
 +--------------+---------+
-student_id is the unique identifier for this table.
-Each row contains information about a student and their academic major.
+student_id 是这张表的唯一主键。
+每一行包含有关学生及其学术专业的信息。
 
-

Table: study_sessions

+

表:study_sessions

 +---------------+---------+
@@ -42,32 +42,33 @@ Each row contains information about a student and their academic major.
 | session_date  | date    |
 | hours_studied | decimal |
 +---------------+---------+
-session_id is the unique identifier for this table.
-Each row represents a study session by a student for a specific subject.
+session_id 是这张表的唯一主键。
+每一行代表一个学生针对特定学科的学习时段。
 
-

Write a solution to find students who follow the Study Spiral Pattern - students who consistently study multiple subjects in a rotating cycle.

+

编写一个解决方案来找出遵循 螺旋学习模式 的学生——即那些持续学习多个学科并按循环周期进行学习的学生。

    -
  • A Study Spiral Pattern means a student studies at least 3 different subjects in a repeating sequence
  • -
  • The pattern must repeat for at least 2 complete cycles (minimum 6 study sessions)
  • -
  • Sessions must be consecutive dates with no gaps longer than 2 days between sessions
  • -
  • Calculate the cycle length (number of different subjects in the pattern)
  • -
  • Calculate the total study hours across all sessions in the pattern
  • -
  • Only include students with cycle length of at least 3 subjects
  • +
  • 螺旋学习模式意味着学生以重复的顺序学习至少 3不同的学科
  • +
  • 模式必须重复 至少 2 个完整周期(最少 6 次学习记录)。
  • +
  • 两次学习记录必须是间隔不超过 2 天的 连续日期
  • +
  • 计算 循环长度(模式中不同的学科数量)。
  • +
  • 计算模式中所有学习记录的 总学习时长
  • +
  • 仅包含循环长度 至少为  3 门学科 的学生。
-

Return the result table ordered by cycle length in descending order, then by total study hours in descending order.

+

返回结果表按循环长度 降序 排序,然后按总学习时间 降序 排序。

-

The result format is in the following example.

+

结果格式如下所示。

 

-

Example:

+ +

示例:

-

Input:

+

输入:

-

students table:

+

students 表:

 +------------+--------------+------------------+
@@ -81,7 +82,7 @@ Each row represents a study session by a student for a specific subject.
 +------------+--------------+------------------+
 
-

study_sessions table:

+

study_sessions 表:

 +------------+------------+------------+--------------+---------------+
@@ -110,7 +111,7 @@ Each row represents a study session by a student for a specific subject.
 +------------+------------+------------+--------------+---------------+
 
-

Output:

+

输出:

 +------------+--------------+------------------+--------------+-------------------+
@@ -121,39 +122,39 @@ Each row represents a study session by a student for a specific subject.
 +------------+--------------+------------------+--------------+-------------------+
 
-

Explanation:

+

解释:

  • Alice Chen (student_id = 1):
      -
    • Study sequence: Math → Physics → Chemistry → Math → Physics → Chemistry
    • -
    • Pattern: 3 subjects (Math, Physics, Chemistry) repeating for 2 complete cycles
    • -
    • Consecutive dates: Oct 1-6 with no gaps > 2 days
    • -
    • Cycle length: 3 subjects
    • -
    • Total hours: 2.5 + 3.0 + 2.0 + 2.5 + 3.0 + 2.0 = 15.0 hours
    • +
    • 学习序列:Math → Physics → Chemistry → Math → Physics → Chemistry
    • +
    • 模式:3 门学科(Math,Physics,Chemistry)重复 2 个完整周期
    • +
    • 连续日期:十月 1-6,没有超过 2 天的间隔
    • +
    • 循环长度:3 门学科
    • +
    • 总时间:2.5 + 3.0 + 2.0 + 2.5 + 3.0 + 2.0 = 15.0 小时
  • Bob Johnson (student_id = 2):
      -
    • Study sequence: Algebra → Calculus → Statistics → Geometry → Algebra → Calculus → Statistics → Geometry
    • -
    • Pattern: 4 subjects (Algebra, Calculus, Statistics, Geometry) repeating for 2 complete cycles
    • -
    • Consecutive dates: Oct 1-8 with no gaps > 2 days
    • -
    • Cycle length: 4 subjects
    • -
    • Total hours: 4.0 + 3.5 + 2.5 + 3.0 + 4.0 + 3.5 + 2.5 + 3.0 = 26.0 hours
    • +
    • 学习序列:Algebra → Calculus → Statistics → Geometry → Algebra → Calculus → Statistics → Geometry
    • +
    • 模式:4 门学科(Algebra,Calculus,Statistics,Geometry)重复 2 个完整周期
    • +
    • 连续日期:十月 1-8,没有超过 2 天的间隔
    • +
    • 循环长度:4 门学科
    • +
    • 总时间:4.0 + 3.5 + 2.5 + 3.0 + 4.0 + 3.5 + 2.5 + 3.0 = 26.0 小时
  • -
  • Students not included: +
  • 未包含学生:
      -
    • Carol Davis (student_id = 3): Only 2 subjects (Biology, Chemistry) - doesn't meet minimum 3 subjects requirement
    • -
    • David Wilson (student_id = 4): Only 2 study sessions with a 4-day gap - doesn't meet consecutive dates requirement
    • -
    • Emma Brown (student_id = 5): No study sessions recorded
    • +
    • Carol Davis (student_id = 3):仅 2 门学科(生物,化学)- 未满足至少 3 门学科的要求
    • +
    • David Wilson (student_id = 4):仅 2 次学习课程,间隔 4 天 - 不符合连续日期要求
    • +
    • Emma Brown (student_id = 5):没有记录学习课程
-

The result table is ordered by cycle_length in descending order, then by total_study_hours in descending order.

+

结果表以 cycle_length 降序排序,然后以 total_study_hours 降序排序。

@@ -299,7 +300,8 @@ WITH SUBSTRING_INDEX(SUBSTRING_INDEX(subject_sequence, ',', 6), ',', -3), '%' ) - OR subject_sequence LIKE CONCAT( -- 匹配4科循环2轮的模式 + OR subject_sequence LIKE CONCAT( + -- 匹配4科循环2轮的模式 SUBSTRING_INDEX(subject_sequence, ',', 4), ',', SUBSTRING_INDEX(SUBSTRING_INDEX(subject_sequence, ',', 8), ',', -4), diff --git a/solution/DATABASE_README.md b/solution/DATABASE_README.md index 6e259ae79c78a..abb2b37a63832 100644 --- a/solution/DATABASE_README.md +++ b/solution/DATABASE_README.md @@ -321,8 +321,8 @@ | 3580 | [寻找持续进步的员工](/solution/3500-3599/3580.Find%20Consistently%20Improving%20Employees/README.md) | `数据库` | 中等 | | | 3586 | [寻找 COVID 康复患者](/solution/3500-3599/3586.Find%20COVID%20Recovery%20Patients/README.md) | `数据库` | 中等 | | | 3601 | [寻找燃油效率提升的驾驶员](/solution/3600-3699/3601.Find%20Drivers%20with%20Improved%20Fuel%20Efficiency/README.md) | `数据库` | 中等 | | -| 3611 | [查找超预订员工](/solution/3600-3699/3611.Find%20Overbooked%20Employees/README.md) | | 中等 | | -| 3617 | [Find Students with Study Spiral Pattern](/solution/3600-3699/3617.Find%20Students%20with%20Study%20Spiral%20Pattern/README.md) | | 困难 | | +| 3611 | [查找超预订员工](/solution/3600-3699/3611.Find%20Overbooked%20Employees/README.md) | `数据库` | 中等 | | +| 3617 | [查找具有螺旋学习模式的学生](/solution/3600-3699/3617.Find%20Students%20with%20Study%20Spiral%20Pattern/README.md) | | 困难 | | ## 版权 diff --git a/solution/DATABASE_README_EN.md b/solution/DATABASE_README_EN.md index c7fe9f1d9290c..9ae616d0819a1 100644 --- a/solution/DATABASE_README_EN.md +++ b/solution/DATABASE_README_EN.md @@ -319,7 +319,7 @@ Press Control + F(or Command + F on | 3580 | [Find Consistently Improving Employees](/solution/3500-3599/3580.Find%20Consistently%20Improving%20Employees/README_EN.md) | `Database` | Medium | | | 3586 | [Find COVID Recovery Patients](/solution/3500-3599/3586.Find%20COVID%20Recovery%20Patients/README_EN.md) | `Database` | Medium | | | 3601 | [Find Drivers with Improved Fuel Efficiency](/solution/3600-3699/3601.Find%20Drivers%20with%20Improved%20Fuel%20Efficiency/README_EN.md) | `Database` | Medium | | -| 3611 | [Find Overbooked Employees](/solution/3600-3699/3611.Find%20Overbooked%20Employees/README_EN.md) | | Medium | | +| 3611 | [Find Overbooked Employees](/solution/3600-3699/3611.Find%20Overbooked%20Employees/README_EN.md) | `Database` | Medium | | | 3617 | [Find Students with Study Spiral Pattern](/solution/3600-3699/3617.Find%20Students%20with%20Study%20Spiral%20Pattern/README_EN.md) | | Hard | | ## Copyright diff --git a/solution/README.md b/solution/README.md index b4f539458e615..6612033ced176 100644 --- a/solution/README.md +++ b/solution/README.md @@ -3621,13 +3621,13 @@ | 3608 | [包含 K 个连通分量需要的最小时间](/solution/3600-3699/3608.Minimum%20Time%20for%20K%20Connected%20Components/README.md) | `并查集`,`图`,`二分查找`,`排序` | 中等 | 第 457 场周赛 | | 3609 | [到达目标点的最小移动次数](/solution/3600-3699/3609.Minimum%20Moves%20to%20Reach%20Target%20in%20Grid/README.md) | `数学` | 困难 | 第 457 场周赛 | | 3610 | [目标和所需的最小质数个数](/solution/3600-3699/3610.Minimum%20Number%20of%20Primes%20to%20Sum%20to%20Target/README.md) | | 中等 | 🔒 | -| 3611 | [查找超预订员工](/solution/3600-3699/3611.Find%20Overbooked%20Employees/README.md) | | 中等 | | -| 3612 | [用特殊操作处理字符串 I](/solution/3600-3699/3612.Process%20String%20with%20Special%20Operations%20I/README.md) | | 中等 | 第 458 场周赛 | -| 3613 | [最小化连通分量的最大成本](/solution/3600-3699/3613.Minimize%20Maximum%20Component%20Cost/README.md) | | 中等 | 第 458 场周赛 | -| 3614 | [用特殊操作处理字符串 II](/solution/3600-3699/3614.Process%20String%20with%20Special%20Operations%20II/README.md) | | 困难 | 第 458 场周赛 | -| 3615 | [图中的最长回文路径](/solution/3600-3699/3615.Longest%20Palindromic%20Path%20in%20Graph/README.md) | | 困难 | 第 458 场周赛 | -| 3616 | [Number of Student Replacements](/solution/3600-3699/3616.Number%20of%20Student%20Replacements/README.md) | | 中等 | 🔒 | -| 3617 | [Find Students with Study Spiral Pattern](/solution/3600-3699/3617.Find%20Students%20with%20Study%20Spiral%20Pattern/README.md) | | 困难 | | +| 3611 | [查找超预订员工](/solution/3600-3699/3611.Find%20Overbooked%20Employees/README.md) | `数据库` | 中等 | | +| 3612 | [用特殊操作处理字符串 I](/solution/3600-3699/3612.Process%20String%20with%20Special%20Operations%20I/README.md) | `字符串`,`模拟` | 中等 | 第 458 场周赛 | +| 3613 | [最小化连通分量的最大成本](/solution/3600-3699/3613.Minimize%20Maximum%20Component%20Cost/README.md) | `排序`,`并查集`,`图`,`二分查找` | 中等 | 第 458 场周赛 | +| 3614 | [用特殊操作处理字符串 II](/solution/3600-3699/3614.Process%20String%20with%20Special%20Operations%20II/README.md) | `字符串`,`模拟` | 困难 | 第 458 场周赛 | +| 3615 | [图中的最长回文路径](/solution/3600-3699/3615.Longest%20Palindromic%20Path%20in%20Graph/README.md) | `位运算`,`图`,`字符串`,`动态规划` | 困难 | 第 458 场周赛 | +| 3616 | [学生替换人数](/solution/3600-3699/3616.Number%20of%20Student%20Replacements/README.md) | | 中等 | 🔒 | +| 3617 | [查找具有螺旋学习模式的学生](/solution/3600-3699/3617.Find%20Students%20with%20Study%20Spiral%20Pattern/README.md) | | 困难 | | ## 版权 diff --git a/solution/README_EN.md b/solution/README_EN.md index d2d2c23c4c4e1..83e7f068a0933 100644 --- a/solution/README_EN.md +++ b/solution/README_EN.md @@ -3619,11 +3619,11 @@ Press Control + F(or Command + F on | 3608 | [Minimum Time for K Connected Components](/solution/3600-3699/3608.Minimum%20Time%20for%20K%20Connected%20Components/README_EN.md) | `Union Find`,`Graph`,`Binary Search`,`Sorting` | Medium | Weekly Contest 457 | | 3609 | [Minimum Moves to Reach Target in Grid](/solution/3600-3699/3609.Minimum%20Moves%20to%20Reach%20Target%20in%20Grid/README_EN.md) | `Math` | Hard | Weekly Contest 457 | | 3610 | [Minimum Number of Primes to Sum to Target](/solution/3600-3699/3610.Minimum%20Number%20of%20Primes%20to%20Sum%20to%20Target/README_EN.md) | | Medium | 🔒 | -| 3611 | [Find Overbooked Employees](/solution/3600-3699/3611.Find%20Overbooked%20Employees/README_EN.md) | | Medium | | -| 3612 | [Process String with Special Operations I](/solution/3600-3699/3612.Process%20String%20with%20Special%20Operations%20I/README_EN.md) | | Medium | Weekly Contest 458 | -| 3613 | [Minimize Maximum Component Cost](/solution/3600-3699/3613.Minimize%20Maximum%20Component%20Cost/README_EN.md) | | Medium | Weekly Contest 458 | -| 3614 | [Process String with Special Operations II](/solution/3600-3699/3614.Process%20String%20with%20Special%20Operations%20II/README_EN.md) | | Hard | Weekly Contest 458 | -| 3615 | [Longest Palindromic Path in Graph](/solution/3600-3699/3615.Longest%20Palindromic%20Path%20in%20Graph/README_EN.md) | | Hard | Weekly Contest 458 | +| 3611 | [Find Overbooked Employees](/solution/3600-3699/3611.Find%20Overbooked%20Employees/README_EN.md) | `Database` | Medium | | +| 3612 | [Process String with Special Operations I](/solution/3600-3699/3612.Process%20String%20with%20Special%20Operations%20I/README_EN.md) | `String`,`Simulation` | Medium | Weekly Contest 458 | +| 3613 | [Minimize Maximum Component Cost](/solution/3600-3699/3613.Minimize%20Maximum%20Component%20Cost/README_EN.md) | `Sort`,`Union Find`,`Graph`,`Binary Search` | Medium | Weekly Contest 458 | +| 3614 | [Process String with Special Operations II](/solution/3600-3699/3614.Process%20String%20with%20Special%20Operations%20II/README_EN.md) | `String`,`Simulation` | Hard | Weekly Contest 458 | +| 3615 | [Longest Palindromic Path in Graph](/solution/3600-3699/3615.Longest%20Palindromic%20Path%20in%20Graph/README_EN.md) | `Bit Manipulation`,`Graph`,`String`,`Dynamic Programming` | Hard | Weekly Contest 458 | | 3616 | [Number of Student Replacements](/solution/3600-3699/3616.Number%20of%20Student%20Replacements/README_EN.md) | | Medium | 🔒 | | 3617 | [Find Students with Study Spiral Pattern](/solution/3600-3699/3617.Find%20Students%20with%20Study%20Spiral%20Pattern/README_EN.md) | | Hard | |