diff --git a/solution/0200-0299/0249.Group Shifted Strings/README_EN.md b/solution/0200-0299/0249.Group Shifted Strings/README_EN.md index 00c36408c6461..c5969660b006c 100644 --- a/solution/0200-0299/0249.Group Shifted Strings/README_EN.md +++ b/solution/0200-0299/0249.Group Shifted Strings/README_EN.md @@ -18,28 +18,38 @@ tags: -
We can shift a string by shifting each of its letters to its successive letter.
+Perform the following shift operations on a string:
"abc"
can be shifted to be "bcd"
."abc"
can be right-shifted to "bcd"
or "xyz"
can be right-shifted to "yza"
."bcd"
can be left-shifted to "abc" or
"yza"
can be left-shifted to "xyz"
.We can keep shifting the string to form a sequence.
+We can keep shifting the string in both directions to form an endless shifting sequence.
"abc"
to form the sequence: "abc" -> "bcd" -> ... -> "xyz"
."abc"
to form the sequence: ... <-> "abc" <-> "bcd" <-> ... <-> "xyz" <-> "yza" <-> ...
. <-> "zab" <-> "abc" <-> ...
Given an array of strings strings
, group all strings[i]
that belong to the same shifting sequence. You may return the answer in any order.
You are given an array of strings strings
, group together all strings[i]
that belong to the same shifting sequence. You may return the answer in any order.
Example 1:
-Input: strings = ["abc","bcd","acef","xyz","az","ba","a","z"] -Output: [["acef"],["a","z"],["abc","bcd","xyz"],["az","ba"]] -
Example 2:
-Input: strings = ["a"] -Output: [["a"]] -+ +
Input: strings = ["abc","bcd","acef","xyz","az","ba","a","z"]
+ +Output: [["acef"],["a","z"],["abc","bcd","xyz"],["az","ba"]]
+Example 2:
+ +Input: strings = ["a"]
+ +Output: [["a"]]
+
Constraints:
diff --git a/solution/2500-2599/2595.Number of Even and Odd Bits/README_EN.md b/solution/2500-2599/2595.Number of Even and Odd Bits/README_EN.md index d64b537961ea2..388f02fb909d7 100644 --- a/solution/2500-2599/2595.Number of Even and Odd Bits/README_EN.md +++ b/solution/2500-2599/2595.Number of Even and Odd Bits/README_EN.md @@ -20,32 +20,42 @@ tags:You are given a positive integer n
.
Let even
denote the number of even indices in the binary representation of n
(0-indexed) with value 1
.
Let even
denote the number of even indices in the binary representation of n
with value 1.
Let odd
denote the number of odd indices in the binary representation of n
(0-indexed) with value 1
.
Let odd
denote the number of odd indices in the binary representation of n
with value 1.
Return an integer array answer
where answer = [even, odd]
.
Note that bits are indexed from right to left in the binary representation of a number.
+ +Return the array [even, odd]
.
Example 1:
--Input: n = 17 -Output: [2,0] -Explanation: The binary representation of 17 is 10001. -It contains 1 on the 0th and 4th indices. -There are 2 even and 0 odd indices. -+
Input: n = 50
+ +Output: [1,2]
+ +Explanation:
+ +The binary representation of 50 is 110010
.
It contains 1 on indices 1, 4, and 5.
+Example 2:
--Input: n = 2 -Output: [0,1] -Explanation: The binary representation of 2 is 10. -It contains 1 on the 1st index. -There are 0 even and 1 odd indices. -+
Input: n = 2
+ +Output: [0,1]
+ +Explanation:
+ +The binary representation of 2 is 10
.
It contains 1 only on index 1.
+
Constraints:
diff --git a/solution/2600-2699/2644.Find the Maximum Divisibility Score/README_EN.md b/solution/2600-2699/2644.Find the Maximum Divisibility Score/README_EN.md index 7db963784d53b..615116835685c 100644 --- a/solution/2600-2699/2644.Find the Maximum Divisibility Score/README_EN.md +++ b/solution/2600-2699/2644.Find the Maximum Divisibility Score/README_EN.md @@ -22,7 +22,7 @@ tags:The divisibility score of divisors[i]
is the number of indices j
such that nums[j]
is divisible by divisors[i]
.
Return the integer divisors[i]
with the maximum divisibility score. If multiple numbers have the maximum score, return the smallest one.
Return the integer divisors[i]
with the maximum divisibility score. If multiple integers have the maximum score, return the smallest one.
Example 1:
@@ -58,7 +58,7 @@ tags:The divisibility score of divisors[1]
is 1 since only nums[0]
is divisible by 2.
The divisibility score of divisors[2]
is 3 since nums[2]
, nums[3]
and nums[4]
are divisible by 3.
The divisibility score of divisors[2]
is 3 since nums[2]
, nums[3]
and nums[4]
are divisible by 3.
Example 3:
diff --git a/solution/2800-2899/2862.Maximum Element-Sum of a Complete Subset of Indices/README.md b/solution/2800-2899/2862.Maximum Element-Sum of a Complete Subset of Indices/README.md index 45a2f6a1865ea..07cd5e3b2d88b 100644 --- a/solution/2800-2899/2862.Maximum Element-Sum of a Complete Subset of Indices/README.md +++ b/solution/2800-2899/2862.Maximum Element-Sum of a Complete Subset of Indices/README.md @@ -26,21 +26,29 @@ tags:-
示例 1:
+示例 1:
--输入:nums = [8,7,3,5,7,2,4,9] -输出:16 -解释:我们选择了下标 2 和 8 的元素,并且 2 * 8 是一个完全平方数。 -+
输入:nums = [8,7,3,5,7,2,4,9]
-示例 2:
+输出:16
--输入:nums = [8,10,3,8,1,13,7,9,4] -输出:20 -解释:我们选择了下标 1,4 和 9 的元素。1 * 4,1 * 9,4 * 9 都是完全平方数。 -+
解释:
+ +我们选择下标为 2 和 8 的元素,并且 1 * 4
是一个完全平方数。
示例 2:
+ +输入:nums = [8,10,3,8,1,13,7,9,4]
+ +输出:20
+ +解释:
+ +我们选择下标为 1, 4, 9 的元素。1 * 4
, 1 * 9
, 4 * 9
是完全平方数。
diff --git a/solution/2800-2899/2862.Maximum Element-Sum of a Complete Subset of Indices/README_EN.md b/solution/2800-2899/2862.Maximum Element-Sum of a Complete Subset of Indices/README_EN.md index e53437d23692e..2f2f49892140a 100644 --- a/solution/2800-2899/2862.Maximum Element-Sum of a Complete Subset of Indices/README_EN.md +++ b/solution/2800-2899/2862.Maximum Element-Sum of a Complete Subset of Indices/README_EN.md @@ -34,7 +34,7 @@ tags:
Explanation:
-We select elements at indices 1 and 4 and 1 * 4
is a perfect square.
We select elements at indices 2 and 8 and 1 * 4
is a perfect square.
Example 2:
diff --git a/solution/3100-3199/3173.Bitwise OR of Adjacent Elements/README.md b/solution/3100-3199/3173.Bitwise OR of Adjacent Elements/README.md index 91532df26b795..9e2cabf641569 100644 --- a/solution/3100-3199/3173.Bitwise OR of Adjacent Elements/README.md +++ b/solution/3100-3199/3173.Bitwise OR of Adjacent Elements/README.md @@ -59,7 +59,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3100-3199/3173.Bi 我们遍历数组的前 $n - 1$ 个元素,对于每个元素,计算它和它的下一个元素的按位或值,将结果存入答案数组中。 -时间复杂度 $O(n)$,其中 $n$ 是数组的长度。空间复杂度 $O(1)$。 +时间复杂度 $O(n)$,其中 $n$ 是数组的长度。忽略答案数组的空间消耗,空间复杂度 $O(1)$。 diff --git a/solution/3100-3199/3173.Bitwise OR of Adjacent Elements/README_EN.md b/solution/3100-3199/3173.Bitwise OR of Adjacent Elements/README_EN.md index 47f67a39e49be..659c10ddfb2cc 100644 --- a/solution/3100-3199/3173.Bitwise OR of Adjacent Elements/README_EN.md +++ b/solution/3100-3199/3173.Bitwise OR of Adjacent Elements/README_EN.md @@ -59,7 +59,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3100-3199/3173.Bi We iterate through the first $n - 1$ elements of the array. For each element, we calculate the bitwise OR value of it and its next element, and store the result in the answer array. -The time complexity is $O(n)$, where $n$ is the length of the array. The space complexity is $O(1)$. +The time complexity is $O(n)$, where $n$ is the length of the array. Ignoring the space consumption of the answer array, the space complexity is $O(1)$.