You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/0200-0299/0249.Group Shifted Strings/README_EN.md
+21-11
Original file line number
Diff line number
Diff line change
@@ -18,28 +18,38 @@ tags:
18
18
19
19
<!-- description:start -->
20
20
21
-
<p>We can shift a string by shifting each of its letters to its successive letter.</p>
21
+
<p>Perform the following shift operations on a string:</p>
22
22
23
23
<ul>
24
-
<li>For example, <code>"abc"</code> can be shifted to be <code>"bcd"</code>.</li>
24
+
<li><strong>Right shift</strong>: Replace every letter with the <strong>successive</strong> letter of the English alphabet, where 'z' is replaced by 'a'. For example, <code>"abc"</code> can be right-shifted to <code>"bcd" </code>or <code>"xyz"</code> can be right-shifted to <code>"yza"</code>.</li>
25
+
<li><strong>Left shift</strong>: Replace every letter with the <strong>preceding</strong> letter of the English alphabet, where 'a' is replaced by 'z'. For example, <code>"bcd"</code> can be left-shifted to <code>"abc"<font face="Times New Roman"> or </font></code><code>"yza"</code> can be left-shifted to <code>"xyz"</code>.</li>
25
26
</ul>
26
27
27
-
<p>We can keep shifting the string to form a sequence.</p>
28
+
<p>We can keep shifting the string in both directions to form an <strong>endless</strong> <strong>shifting sequence</strong>.</p>
28
29
29
30
<ul>
30
-
<li>For example, we can keep shifting <code>"abc"</code> to form the sequence: <code>"abc" -> "bcd" -> ... -> "xyz"</code>.</li>
31
+
<li>For example, shift <code>"abc"</code> to form the sequence: <code>... <-> "abc" <-> "bcd" <-> ... <-> "xyz" <-> "yza" <-> ...</code>.<code> <-> "zab" <-> "abc" <-> ...</code></li>
31
32
</ul>
32
33
33
-
<p>Given an array of strings <code>strings</code>, group all <code>strings[i]</code> that belong to the same shifting sequence. You may return the answer in <strong>any order</strong>.</p>
34
+
<p>You are given an array of strings <code>strings</code>, group together all <code>strings[i]</code> that belong to the same shifting sequence. You may return the answer in <strong>any order</strong>.</p>
Copy file name to clipboardexpand all lines: solution/2500-2599/2595.Number of Even and Odd Bits/README_EN.md
+27-17
Original file line number
Diff line number
Diff line change
@@ -20,32 +20,42 @@ tags:
20
20
21
21
<p>You are given a <strong>positive</strong> integer <code>n</code>.</p>
22
22
23
-
<p>Let <code>even</code> denote the number of even indices in the binary representation of <code>n</code> (<strong>0-indexed</strong>) with value <code>1</code>.</p>
23
+
<p>Let <code>even</code> denote the number of even indices in the binary representation of <code>n</code> with value 1.</p>
24
24
25
-
<p>Let <code>odd</code> denote the number of odd indices in the binary representation of <code>n</code> (<strong>0-indexed</strong>) with value <code>1</code>.</p>
25
+
<p>Let <code>odd</code> denote the number of odd indices in the binary representation of <code>n</code> with value 1.</p>
26
26
27
-
<p>Return <em>an integer array </em><code>answer</code><em> where </em><code>answer = [even, odd]</code>.</p>
27
+
<p>Note that bits are indexed from <strong>right to left</strong> in the binary representation of a number.</p>
28
+
29
+
<p>Return the array <code>[even, odd]</code>.</p>
28
30
29
31
<p> </p>
30
32
<p><strongclass="example">Example 1:</strong></p>
31
33
32
-
<pre>
33
-
<strong>Input:</strong> n = 17
34
-
<strong>Output:</strong> [2,0]
35
-
<strong>Explanation:</strong> The binary representation of 17 is 10001.
36
-
It contains 1 on the 0<sup>th</sup> and 4<sup>th</sup> indices.
Copy file name to clipboardexpand all lines: solution/2600-2699/2644.Find the Maximum Divisibility Score/README_EN.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ tags:
22
22
23
23
<p>The <strong>divisibility score</strong> of <code>divisors[i]</code> is the number of indices <code>j</code> such that <code>nums[j]</code> is divisible by <code>divisors[i]</code>.</p>
24
24
25
-
<p>Return the integer <code>divisors[i]</code> with the <strong>maximum</strong> divisibility score. If multiple numbers have the maximum score, return the smallest one.</p>
25
+
<p>Return the integer <code>divisors[i]</code> with the <strong>maximum</strong> divisibility score. If multiple integers have the maximum score, return the smallest one.</p>
26
26
27
27
<p> </p>
28
28
<p><strongclass="example">Example 1:</strong></p>
@@ -58,7 +58,7 @@ tags:
58
58
59
59
<p>The divisibility score of <code>divisors[1]</code> is 1 since only <code>nums[0]</code> is divisible by 2.</p>
60
60
61
-
<p>The divisibility score of <code>divisors[2]</code> is 3 since <code>nums[2]</code>, <code>nums[3]</code> and <code>nums[4]</code> are divisible by 3.</p>
61
+
<p>The divisibility score of <code>divisors[2]</code> is 3 since <code>nums[2]</code>, <code>nums[3]</code> and <code>nums[4]</code> are divisible by 3.</p>
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.
61
61
62
-
The time complexity is $O(n)$, where $n$ is the length of the array. The space complexity is $O(1)$.
62
+
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)$.
0 commit comments