From 1ad50ca5912bf4be5debc1ff326cc8d25d8c0e8b Mon Sep 17 00:00:00 2001 From: yanglbme Date: Thu, 24 Oct 2024 08:23:58 +0800 Subject: [PATCH] feat: update lc problems --- .../README_EN.md | 2 +- .../README.md | 2 +- .../3308.Find Top Performing Driver/README.md | 53 ++++++++-------- .../README.md | 4 +- .../README.md | 61 ++++++++++--------- .../README_EN.md | 6 +- .../README.md | 42 +++++++------ solution/DATABASE_README.md | 4 +- solution/README.md | 6 +- 9 files changed, 92 insertions(+), 88 deletions(-) diff --git a/solution/0500-0599/0555.Split Concatenated Strings/README_EN.md b/solution/0500-0599/0555.Split Concatenated Strings/README_EN.md index 8565aae1cc864..af50bfc27a124 100644 --- a/solution/0500-0599/0555.Split Concatenated Strings/README_EN.md +++ b/solution/0500-0599/0555.Split Concatenated Strings/README_EN.md @@ -37,7 +37,7 @@ tags:
 Input: strs = ["abc","xyz"]
 Output: "zyxcba"
-Explanation: You can get the looped string "-abcxyz-", "-abczyx-", "-cbaxyz-", "-cbazyx-", where '-' represents the looped status.
+Explanation: You can get the looped string "-abcxyz-", "-abczyx-", "-cbaxyz-", "-cbazyx-", where '-' represents the looped status. 
 The answer string came from the fourth looped one, where you could cut from the middle character 'a' and get "zyxcba".
 
diff --git a/solution/3100-3199/3193.Count the Number of Inversions/README.md b/solution/3100-3199/3193.Count the Number of Inversions/README.md index 8d939c1912e37..a4bcceb10ad4b 100644 --- a/solution/3100-3199/3193.Count the Number of Inversions/README.md +++ b/solution/3100-3199/3193.Count the Number of Inversions/README.md @@ -27,7 +27,7 @@ tags:
  • i < j 且 nums[i] > nums[j]
  • -

    请你返回 [0, 1, 2, ..., n - 1] 的 排列 perm 的数目,满足对 所有 的 requirements[i] 都有 perm[0..endi] 恰好有 cnti 个逆序对。

    +

    请你返回 [0, 1, 2, ..., n - 1] 的 排列 perm 的数目,满足对 所有 的 requirements[i] 都满足 perm[0..endi] 中恰好有 cnti 个逆序对。

    由于答案可能会很大,将它对 109 + 7 取余 后返回。

    diff --git a/solution/3300-3399/3308.Find Top Performing Driver/README.md b/solution/3300-3399/3308.Find Top Performing Driver/README.md index d4f6ae8844bdf..68fd6742feda9 100644 --- a/solution/3300-3399/3308.Find Top Performing Driver/README.md +++ b/solution/3300-3399/3308.Find Top Performing Driver/README.md @@ -8,7 +8,7 @@ tags: -# [3308. Find Top Performing Driver 🔒](https://leetcode.cn/problems/find-top-performing-driver) +# [3308. 寻找表现最佳的司机 🔒](https://leetcode.cn/problems/find-top-performing-driver) [English Version](/solution/3300-3399/3308.Find%20Top%20Performing%20Driver/README_EN.md) @@ -16,7 +16,7 @@ tags: -

    Table: Drivers

    +

    表:Drivers

     +--------------+---------+
    @@ -28,11 +28,11 @@ tags:
     | experience   | int     |
     | accidents    | int     |
     +--------------+---------+
    -(driver_id) is the unique key for this table.
    -Each row includes a driver's ID, their name, age, years of driving experience, and the number of accidents they’ve had.
    +(driver_id) 是这张表的唯一主键。
    +每一行包含一个司机 ID,他们的名字,年龄,驾龄年数,以及事故数。
     
    -

    Table: Vehicles

    +

    表:Vehicles

     +--------------+---------+
    @@ -42,11 +42,11 @@ Each row includes a driver's ID, their name, age, years of driving experienc
     | fuel_type    | varchar |
     | mileage      | int     |
     +--------------+---------+
    -(vehicle_id, driver_id, fuel_type) is the unique key for this table.
    -Each row includes the vehicle's ID, the driver who operates it, the model, fuel type, and mileage.
    +(vehicle_id, driver_id, fuel_type) 是这张表的唯一主键。
    +每一行包含机动车 ID,驾驶员,车型,动力类型和里程数。
     
    -

    Table: Trips

    +

    表:Trips

     +--------------+---------+
    @@ -56,29 +56,30 @@ Each row includes the vehicle's ID, the driver who operates it, the model, f
     | duration     | int     |
     | rating       | int     |
     +--------------+---------+
    -(trip_id) is the unique key for this table.
    -Each row includes a trip's ID, the vehicle used, the distance covered (in miles), the trip duration (in minutes), and the passenger's rating (1-5).
    +(trip_id) 是这张表的唯一主键。
    +每一行包含行程 ID,使用的机动车,覆盖的距离(以米计),行程市场(以分钟计),以及乘客评分(1-5)。
     
    -

    Uber is analyzing drivers based on their trips. Write a solution to find the top-performing driver for each fuel type based on the following criteria:

    +

    优步正在基于司机的行程分析他们的情况。编写一个解决方案,根据下列标准来找到 每种动力类型 中 表现最好的司机

      -
    1. A driver's performance is calculated as the average rating across all their trips. Average rating should be rounded to 2 decimal places.
    2. -
    3. If two drivers have the same average rating, the driver with the longer total distance traveled should be ranked higher.
    4. -
    5. If there is still a tie, choose the driver with the fewest accidents.
    6. +
    7. 一个司机的表现由他们行程的 平均评分 计算。平均评分应该舍入到 2 位小数。
    8. +
    9. 如果两个司机有相同的平均评分,里程数更多 的司机评分更高。
    10. +
    11. 如果 依旧持平,选择 事故数最少 的司机。
    -

    Return the result table ordered by fuel_type in ascending order.

    +

    返回结果表以 fuel_type 升序 排序。

    -

    The result format is in the following example.

    +

    结果格式如下所示。

     

    -

    Example:

    + +

    示例:

    -

    Input:

    +

    输入:

    -

    Drivers table:

    +

    Drivers 表:

     +-----------+----------+-----+------------+-----------+
    @@ -90,7 +91,7 @@ Each row includes a trip's ID, the vehicle used, the distance covered (in mi
     +-----------+----------+-----+------------+-----------+
     
    -

    Vehicles table:

    +

    Vehicles 表:

     +------------+-----------+---------+-----------+---------+
    @@ -102,7 +103,7 @@ Each row includes a trip's ID, the vehicle used, the distance covered (in mi
     +------------+-----------+---------+-----------+---------+
     
    -

    Trips table:

    +

    Trips 表:

     +---------+------------+----------+----------+--------+
    @@ -117,7 +118,7 @@ Each row includes a trip's ID, the vehicle used, the distance covered (in mi
     +---------+------------+----------+----------+--------+
     
    -

    Output:

    +

    输出:

     +-----------+-----------+--------+----------+
    @@ -128,14 +129,14 @@ Each row includes a trip's ID, the vehicle used, the distance covered (in mi
     +-----------+-----------+--------+----------+
     
    -

    Explanation:

    +

    解释:

    -

    The output table is ordered by fuel_type in ascending order.

    +

    输出表以 fuel_type 升序排序。

    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 719b2eb7187de..043f1dfbd358c 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 @@ -39,13 +39,11 @@ tags:

    请你返回字符串 answer 。

    -

    回文串 指的是一个字符串从前往后与从后往前是一模一样的。

    -

     

    示例 1:

    diff --git a/solution/3300-3399/3328.Find Cities in Each State II/README.md b/solution/3300-3399/3328.Find Cities in Each State II/README.md index e7ad9f14a1b4e..7293a26a44c54 100644 --- a/solution/3300-3399/3328.Find Cities in Each State II/README.md +++ b/solution/3300-3399/3328.Find Cities in Each State II/README.md @@ -8,7 +8,7 @@ tags: -# [3328. Find Cities in Each State II 🔒](https://leetcode.cn/problems/find-cities-in-each-state-ii) +# [3328. 查找每个州的城市 II 🔒](https://leetcode.cn/problems/find-cities-in-each-state-ii) [English Version](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README_EN.md) @@ -16,7 +16,7 @@ tags: -

    Table: cities

    +

    表:cities

     +-------------+---------+
    @@ -25,29 +25,30 @@ tags:
     | state       | varchar |
     | city        | varchar |
     +-------------+---------+
    -(state, city) is the combination of columns with unique values for this table.
    -Each row of this table contains the state name and the city name within that state.
    +(state, city) 是这张表中值互不相同的列的组合。
    +这张表的每一行包含州名和其中的城市名。
     
    -

    Write a solution to find all the cities in each state and analyze them based on the following requirements:

    +

    编写一个解决方案来找到 每个州 中的 所有城市 并且根据下列条件分析它们:

    -

    Return the result table ordered by the count of matching-letter cities in descending order and then by state name in ascending order.

    +

    返回结果表以字母匹配城市的数量 降序 排序,然后按州名称 升序 排序的结果表。

    -

    The result format is in the following example.

    +

    结果格式如下所示。

     

    -

    Example:

    + +

    示例:

    -

    Input:

    +

    输入:

    -

    cities table:

    +

    cities 表:

     +--------------+---------------+
    @@ -71,58 +72,58 @@ Each row of this table contains the state name and the city name within that sta
     +--------------+---------------+
     
    -

    Output:

    +

    输出:

     +-------------+-------------------------------------------+-----------------------+
     | state       | cities                                    | matching_letter_count |
     +-------------+-------------------------------------------+-----------------------+
     | Pennsylvania| Philadelphia, Pittsburgh, Pottstown       | 3                     |
    -| Texas       | Dallas, Taylor, Temple, Tyler             | 2                     |
    +| Texas       | Dallas, Taylor, Temple, Tyler             | 3                     |
     | New York    | Buffalo, Newark, New York City, Rochester | 2                     |
     +-------------+-------------------------------------------+-----------------------+
     
    -

    Explanation:

    +

    解释:

    -

    Note:

    +

    注意:

    diff --git a/solution/3300-3399/3328.Find Cities in Each State II/README_EN.md b/solution/3300-3399/3328.Find Cities in Each State II/README_EN.md index 4e2ab5ecec26a..a8e88e1904790 100644 --- a/solution/3300-3399/3328.Find Cities in Each State II/README_EN.md +++ b/solution/3300-3399/3328.Find Cities in Each State II/README_EN.md @@ -78,7 +78,7 @@ Each row of this table contains the state name and the city name within that sta | state | cities | matching_letter_count | +-------------+-------------------------------------------+-----------------------+ | Pennsylvania| Philadelphia, Pittsburgh, Pottstown | 3 | -| Texas | Dallas, Taylor, Temple, Tyler | 2 | +| Texas | Dallas, Taylor, Temple, Tyler | 3 | | New York | Buffalo, Newark, New York City, Rochester | 2 | +-------------+-------------------------------------------+-----------------------+ @@ -97,8 +97,8 @@ Each row of this table contains the state name and the city name within that sta
  • Texas:
  • New York: diff --git a/solution/3300-3399/3329.Count Substrings With K-Frequency Characters II/README.md b/solution/3300-3399/3329.Count Substrings With K-Frequency Characters II/README.md index 7f7f63aa62f1f..97db0d94c04fb 100644 --- a/solution/3300-3399/3329.Count Substrings With K-Frequency Characters II/README.md +++ b/solution/3300-3399/3329.Count Substrings With K-Frequency Characters II/README.md @@ -8,7 +8,7 @@ tags: -# [3329. Count Substrings With K-Frequency Characters II 🔒](https://leetcode.cn/problems/count-substrings-with-k-frequency-characters-ii) +# [3329. 字符至少出现 K 次的子字符串 II 🔒](https://leetcode.cn/problems/count-substrings-with-k-frequency-characters-ii) [English Version](/solution/3300-3399/3329.Count%20Substrings%20With%20K-Frequency%20Characters%20II/README_EN.md) @@ -16,49 +16,53 @@ tags: -

    Given a string s and an integer k, return the total number of substrings of s where at least one character appears at least k times.

    +

    给你一个字符串 s 和一个整数 k,在 s 的所有 子字符串 中,请你统计并返回 至少有一个 字符 至少出现 k 次的子字符串总数。

     

    -

    Example 1:

    +

    示例 1:

    -

    Input: s = "abacb", k = 2

    -

    Output: 4

    +

    输入: s = "abacb", k = 2

    -

    Explanation:

    +

    输出: 4

    -

    The valid substrings are:

    +

    解释:

    + +

    符合条件的子字符串如下:

      -
    • "aba" (character 'a' appears 2 times).
    • -
    • "abac" (character 'a' appears 2 times).
    • -
    • "abacb" (character 'a' appears 2 times).
    • -
    • "bacb" (character 'b' appears 2 times).
    • +
    • "aba"(字符 'a' 出现 2 次)。
    • +
    • "abac"(字符 'a' 出现 2 次)。
    • +
    • "abacb"(字符 'a' 出现 2 次)。
    • +
    • "bacb"(字符 'b' 出现 2 次)。
    -

    Example 2:

    - +

    示例 2:

    -

    Input: s = "abcde", k = 1

    -

    Output: 15

    +

    输入: s = "abcde", k = 1

    + +

    输出: 15

    -

    Explanation:

    +

    解释:

    -

    All substrings are valid because every character appears at least once.

    +

    所有子字符串都有效,因为每个字符至少出现一次。

     

    -

    Constraints:

    + +

    提示:

    +

     

    + ## 解法 diff --git a/solution/DATABASE_README.md b/solution/DATABASE_README.md index 6bb493531fd59..5e9088ef2fc40 100644 --- a/solution/DATABASE_README.md +++ b/solution/DATABASE_README.md @@ -296,9 +296,9 @@ | 3268 | [查找重叠的班次 II](/solution/3200-3299/3268.Find%20Overlapping%20Shifts%20II/README.md) | `数据库` | 困难 | 🔒 | | 3278 | [寻找数据科学家职位的候选人 II](/solution/3200-3299/3278.Find%20Candidates%20for%20Data%20Scientist%20Position%20II/README.md) | `数据库` | 中等 | 🔒 | | 3293 | [计算产品最终价格](/solution/3200-3299/3293.Calculate%20Product%20Final%20Price/README.md) | `数据库` | 中等 | 🔒 | -| 3308 | [Find Top Performing Driver](/solution/3300-3399/3308.Find%20Top%20Performing%20Driver/README.md) | `数据库` | 中等 | 🔒 | +| 3308 | [寻找表现最佳的司机](/solution/3300-3399/3308.Find%20Top%20Performing%20Driver/README.md) | `数据库` | 中等 | 🔒 | | 3322 | [英超积分榜排名 III](/solution/3300-3399/3322.Premier%20League%20Table%20Ranking%20III/README.md) | `数据库` | 中等 | 🔒 | -| 3328 | [Find Cities in Each State II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README.md) | `数据库` | 中等 | 🔒 | +| 3328 | [查找每个州的城市 II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README.md) | `数据库` | 中等 | 🔒 | ## 版权 diff --git a/solution/README.md b/solution/README.md index c2d319e9e99df..04cc380d9406d 100644 --- a/solution/README.md +++ b/solution/README.md @@ -3318,7 +3318,7 @@ | 3305 | [元音辅音字符串计数 I](/solution/3300-3399/3305.Count%20of%20Substrings%20Containing%20Every%20Vowel%20and%20K%20Consonants%20I/README.md) | `哈希表`,`字符串`,`滑动窗口` | 中等 | 第 417 场周赛 | | 3306 | [元音辅音字符串计数 II](/solution/3300-3399/3306.Count%20of%20Substrings%20Containing%20Every%20Vowel%20and%20K%20Consonants%20II/README.md) | `哈希表`,`字符串`,`滑动窗口` | 中等 | 第 417 场周赛 | | 3307 | [找出第 K 个字符 II](/solution/3300-3399/3307.Find%20the%20K-th%20Character%20in%20String%20Game%20II/README.md) | `位运算`,`递归`,`数学` | 困难 | 第 417 场周赛 | -| 3308 | [Find Top Performing Driver](/solution/3300-3399/3308.Find%20Top%20Performing%20Driver/README.md) | `数据库` | 中等 | 🔒 | +| 3308 | [寻找表现最佳的司机](/solution/3300-3399/3308.Find%20Top%20Performing%20Driver/README.md) | `数据库` | 中等 | 🔒 | | 3309 | [连接二进制表示可形成的最大数值](/solution/3300-3399/3309.Maximum%20Possible%20Number%20by%20Binary%20Concatenation/README.md) | `位运算`,`数组`,`枚举` | 中等 | 第 418 场周赛 | | 3310 | [移除可疑的方法](/solution/3300-3399/3310.Remove%20Methods%20From%20Project/README.md) | `深度优先搜索`,`广度优先搜索`,`图` | 中等 | 第 418 场周赛 | | 3311 | [构造符合图结构的二维矩阵](/solution/3300-3399/3311.Construct%202D%20Grid%20Matching%20Graph%20Layout/README.md) | `图`,`数组`,`哈希表`,`矩阵` | 困难 | 第 418 场周赛 | @@ -3338,8 +3338,8 @@ | 3325 | [字符至少出现 K 次的子字符串 I](/solution/3300-3399/3325.Count%20Substrings%20With%20K-Frequency%20Characters%20I/README.md) | `哈希表`,`字符串`,`滑动窗口` | 中等 | 第 420 场周赛 | | 3326 | [使数组非递减的最少除法操作次数](/solution/3300-3399/3326.Minimum%20Division%20Operations%20to%20Make%20Array%20Non%20Decreasing/README.md) | `贪心`,`数组`,`数学`,`数论` | 中等 | 第 420 场周赛 | | 3327 | [判断 DFS 字符串是否是回文串](/solution/3300-3399/3327.Check%20if%20DFS%20Strings%20Are%20Palindromes/README.md) | `树`,`深度优先搜索`,`数组`,`哈希表`,`字符串`,`哈希函数` | 困难 | 第 420 场周赛 | -| 3328 | [Find Cities in Each State II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README.md) | `数据库` | 中等 | 🔒 | -| 3329 | [Count Substrings With K-Frequency Characters II](/solution/3300-3399/3329.Count%20Substrings%20With%20K-Frequency%20Characters%20II/README.md) | `滑动窗口` | 困难 | 🔒 | +| 3328 | [查找每个州的城市 II](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README.md) | `数据库` | 中等 | 🔒 | +| 3329 | [字符至少出现 K 次的子字符串 II](/solution/3300-3399/3329.Count%20Substrings%20With%20K-Frequency%20Characters%20II/README.md) | `滑动窗口` | 困难 | 🔒 | ## 版权