diff --git a/solution/0100-0199/0165.Compare Version Numbers/README_EN.md b/solution/0100-0199/0165.Compare Version Numbers/README_EN.md index 365ead7268eb8..5244f1689efd8 100644 --- a/solution/0100-0199/0165.Compare Version Numbers/README_EN.md +++ b/solution/0100-0199/0165.Compare Version Numbers/README_EN.md @@ -6,14 +6,9 @@ ## Description -

Given two version numbers, version1 and version2, compare them.

+

Given two version stringsversion1 and version2, compare them. A version string consists of revisions separated by dots '.'. The value of the revision is its integer conversion ignoring leading zeros.

- - -

Version numbers consist of one or more revisions joined by a dot '.'. Each revision consists of digits and may contain leading zeros. Every revision contains at least one character. Revisions are 0-indexed from left to right, with the leftmost revision being revision 0, the next revision being revision 1, and so on. For example 2.5.33 and 0.1 are valid version numbers.

- -

To compare version numbers, compare their revisions in left-to-right order. Revisions are compared using their integer value ignoring any leading zeros. This means that revisions 1 and 001 are considered equal. If a version number does not specify a revision at an index, then treat the revision as 0. For example, version 1.0 is less than version 1.1 because their revision 0s are the same, but their revision 1s are 0 and 1 respectively, and 0 < 1.

+

To compare version strings, compare their revision values in left-to-right order. If one of the version strings has fewer revisions, treat the missing revision values as 0.

Return the following:

@@ -26,27 +21,39 @@

 

Example 1:

-
-Input: version1 = "1.01", version2 = "1.001"
-Output: 0
-Explanation: Ignoring leading zeroes, both "01" and "001" represent the same integer "1".
-
+
+

Input: version1 = "1.2", version2 = "1.10"

+ +

Output: -1

+ +

Explanation:

+ +

version1's second revision is "2" and version2's second revision is "10": 2 < 10, so version1 < version2.

+

Example 2:

-
-Input: version1 = "1.0", version2 = "1.0.0"
-Output: 0
-Explanation: version1 does not specify revision 2, which means it is treated as "0".
-
+
+

Input: version1 = "1.01", version2 = "1.001"

+ +

Output: 0

+ +

Explanation:

+ +

Ignoring leading zeroes, both "01" and "001" represent the same integer "1".

+

Example 3:

-
-Input: version1 = "0.1", version2 = "1.1"
-Output: -1
-Explanation: version1's revision 0 is "0", while version2's revision 0 is "1". 0 < 1, so version1 < version2.
-
+
+

Input: version1 = "1.0", version2 = "1.0.0.0"

+ +

Output: 0

+ +

Explanation:

+ +

version1 has less revisions, which means every missing revision are treated as "0".

+

 

Constraints:

diff --git a/solution/0800-0899/0857.Minimum Cost to Hire K Workers/README.md b/solution/0800-0899/0857.Minimum Cost to Hire K Workers/README.md index 91ba70764ed0c..ddca8ffaf7618 100644 --- a/solution/0800-0899/0857.Minimum Cost to Hire K Workers/README.md +++ b/solution/0800-0899/0857.Minimum Cost to Hire K Workers/README.md @@ -10,7 +10,7 @@

n 名工人。 给定两个数组 quality 和 wage ,其中,quality[i] 表示第 i 名工人的工作质量,其最低期望工资为 wage[i] 。

-

现在我们想雇佣 k 名工人组成一个工资组。在雇佣 一组 k 名工人时,我们必须按照下述规则向他们支付工资:

+

现在我们想雇佣 k 名工人组成一个 工资组在雇佣 一组 k 名工人时,我们必须按照下述规则向他们支付工资:

  1. 对工资组中的每名工人,应当按其工作质量与同组其他工人的工作质量的比例来支付工资。
  2. @@ -24,14 +24,14 @@
    -

    示例 1:

    +

    示例 1:

     输入: quality = [10,20,5], wage = [70,50,30], k = 2
     输出: 105.00000
     解释: 我们向 0 号工人支付 70,向 2 号工人支付 35。
    -

    示例 2:

    +

    示例 2:

     输入: quality = [3,1,10,10,1], wage = [4,8,2,2,7], k = 3
    diff --git a/solution/0800-0899/0857.Minimum Cost to Hire K Workers/README_EN.md b/solution/0800-0899/0857.Minimum Cost to Hire K Workers/README_EN.md
    index 1c9396b3c66f8..51b31be8668a3 100644
    --- a/solution/0800-0899/0857.Minimum Cost to Hire K Workers/README_EN.md	
    +++ b/solution/0800-0899/0857.Minimum Cost to Hire K Workers/README_EN.md	
    @@ -8,11 +8,11 @@
     
     

    There are n workers. You are given two integer arrays quality and wage where quality[i] is the quality of the ith worker and wage[i] is the minimum wage expectation for the ith worker.

    -

    We want to hire exactly k workers to form a paid group. To hire a group of k workers, we must pay them according to the following rules:

    +

    We want to hire exactly k workers to form a paid group. To hire a group of k workers, we must pay them according to the following rules:

      -
    1. Every worker in the paid group should be paid in the ratio of their quality compared to other workers in the paid group.
    2. Every worker in the paid group must be paid at least their minimum wage expectation.
    3. +
    4. In the group, each worker's pay must be directly proportional to their quality. This means if a worker’s quality is double that of another worker in the group, then they must be paid twice as much as the other worker.

    Given the integer k, return the least amount of money needed to form a paid group satisfying the above conditions. Answers within 10-5 of the actual answer will be accepted.

    diff --git a/solution/1100-1199/1112.Highest Grade For Each Student/README.md b/solution/1100-1199/1112.Highest Grade For Each Student/README.md index 11bd9ce0add27..3fcf11f814b38 100644 --- a/solution/1100-1199/1112.Highest Grade For Each Student/README.md +++ b/solution/1100-1199/1112.Highest Grade For Each Student/README.md @@ -25,8 +25,6 @@ grade 不会为 NULL。

    编写解决方案,找出每位学生获得的最高成绩和它所对应的科目,若科目成绩并列,取 course_id 最小的一门。查询结果需按 student_id 增序进行排序。

    -

    任意顺序 返回结果表。

    -

    查询结果格式如下所示。

     

    diff --git a/solution/2000-2099/2077.Paths in Maze That Lead to Same Room/README.md b/solution/2000-2099/2077.Paths in Maze That Lead to Same Room/README.md index a5802c08cfc02..1ebcc2e560a79 100644 --- a/solution/2000-2099/2077.Paths in Maze That Lead to Same Room/README.md +++ b/solution/2000-2099/2077.Paths in Maze That Lead to Same Room/README.md @@ -8,7 +8,7 @@ -

    迷宫由 n 个从 1n 的房间组成,有些房间由走廊连接。给定一个二维整数数组 corridors,其中 corridors[i] = [room1i, room2i] 表示有一条走廊连接 room1iroom2i,允许迷宫中的一个人从 room1iroom1i反之亦然

    +

    迷宫由 n 个从 1n 的房间组成,有些房间由走廊连接。给定一个二维整数数组 corridors,其中 corridors[i] = [room1i, room2i] 表示有一条走廊连接 room1iroom2i,允许迷宫中的一个人从 room1iroom2i反之亦然

    迷宫的设计者想知道迷宫有多让人困惑。迷宫的 混乱分数 是 长度为 3 的不同的环的数量。

    diff --git a/solution/2100-2199/2105.Watering Plants II/README.md b/solution/2100-2199/2105.Watering Plants II/README.md index 114f059f467aa..1689bc12472cd 100644 --- a/solution/2100-2199/2105.Watering Plants II/README.md +++ b/solution/2100-2199/2105.Watering Plants II/README.md @@ -14,11 +14,9 @@

    给你一个下标从 0 开始的整数数组 plants ,数组由 n 个整数组成。其中,plants[i] 为第 i 株植物需要的水量。另有两个整数 capacityA 和 capacityB 分别表示 Alice 和 Bob 水罐的容量。返回两人浇灌所有植物过程中重新灌满水罐的 次数

    diff --git a/solution/2500-2599/2563.Count the Number of Fair Pairs/README.md b/solution/2500-2599/2563.Count the Number of Fair Pairs/README.md index 7f33612356aa8..fc9c072a6e37d 100644 --- a/solution/2500-2599/2563.Count the Number of Fair Pairs/README.md +++ b/solution/2500-2599/2563.Count the Number of Fair Pairs/README.md @@ -32,7 +32,7 @@
     输入:nums = [1,7,9,2,5], lower = 11, upper = 11
     输出:1
    -解释:只有单个公平数对:(2,9) 。
    +解释:只有单个公平数对:(2,3) 。
     

     

    diff --git a/solution/3100-3199/3141.Maximum Hamming Distances/README.md b/solution/3100-3199/3141.Maximum Hamming Distances/README.md index fad89a0244cd1..5cf76b155d39d 100644 --- a/solution/3100-3199/3141.Maximum Hamming Distances/README.md +++ b/solution/3100-3199/3141.Maximum Hamming Distances/README.md @@ -1,4 +1,4 @@ -# [3141. Maximum Hamming Distances 🔒](https://leetcode.cn/problems/maximum-hamming-distances) +# [3141. 最大海明距离 🔒](https://leetcode.cn/problems/maximum-hamming-distances) [English Version](/solution/3100-3199/3141.Maximum%20Hamming%20Distances/README_EN.md) @@ -8,55 +8,57 @@ -

    Given an array nums and an integer m, with each element nums[i] satisfying 0 <= nums[i] < 2m, return an array answer. The answer array should be of the same length as nums, where each element answer[i] represents the maximum Hamming distance between nums[i] and any other element nums[j] in the array.

    +

    给定一个数组 nums 和一个整数 m,每个元素 nums[i] 满足 0 <= nums[i] < 2m,返回数组 answeranswer 数组应该与 nums  有相同的长度,每个元素 answer[i] 表示 nums[i] 和数组中其它任何元素 nums[j] 的最大 海明距离

    -

    The Hamming distance between two binary integers is defined as the number of positions at which the corresponding bits differ (add leading zeroes if needed).

    +

    两个二进制整数之间的 海明距离 定义为对应位上二进制位不同的数量(如果需要,添加前置零)。

     

    -

    Example 1:

    + +

    示例 1:

    -

    Input: nums = [9,12,9,11], m = 4

    +

    输入:nums = [9,12,9,11], m = 4

    -

    Output: [2,3,2,3]

    +

    输出:[2,3,2,3]

    -

    Explanation:

    +

    解释:

    -

    The binary representation of nums = [1001,1100,1001,1011].

    +

    二进制表示为 nums = [1001,1100,1001,1011]

    -

    The maximum hamming distances for each index are:

    +

    每个下标的最大海明距离为:

    -

    Example 2:

    +

    示例 2:

    -

    Input: nums = [3,4,6,10], m = 4

    +

    输入:nums = [3,4,6,10], m = 4

    -

    Output: [3,3,2,3]

    +

    输出:[3,3,2,3]

    -

    Explanation:

    +

    解释:

    -

    The binary representation of nums = [0011,0100,0110,1010].

    +

    二进制表示为 nums = [0011,0100,0110,1010]

    -

    The maximum hamming distances for each index are:

    +

    每个下标的最大海明距离为:

     

    -

    Constraints:

    + +

    提示: