1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-13 17:35:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

移除零宽空格

This commit is contained in:
2025-09-28 16:53:26 +08:00
parent 440092a4c3
commit 2862a227c4
43 changed files with 52 additions and 52 deletions

View File

@@ -55,7 +55,7 @@
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
<li><code>s[i]</code> is either <code>&#39;0&#39;</code> or <code>&#39;1&#39;</code>.</li>
<li><code>1 &lt;= k &lt;= s.length</code></li>
</ul>

View File

@@ -2,7 +2,7 @@
<p>An array is considered <strong>balanced</strong> if the value of its <strong>maximum</strong> element is <strong>at most</strong> <code>k</code> times the <strong>minimum</strong> element.</p>
<p>You may remove <strong>any</strong> number of elements from <code>nums</code> without making it <strong>empty</strong>.</p>
<p>You may remove <strong>any</strong> number of elements from <code>nums</code> without making it <strong>empty</strong>.</p>
<p>Return the <strong>minimum</strong> number of elements to remove so that the remaining array is balanced.</p>

View File

@@ -31,5 +31,5 @@ The <strong>frequency</strong> of a digit <code>x</code> is the number of times
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 2<sup>31</sup> - 1</code></li>
<li><code>1 &lt;= n &lt;= 2<sup>31</sup> - 1</code></li>
</ul>

View File

@@ -33,7 +33,7 @@
<ul>
<li>First, delete <code data-end="361" data-start="338">nums[1..3] = [1, 4, 1]</code>, whose sum is 6 (divisible by 3), leaving <code data-end="416" data-start="408">[3, 5]</code>.</li>
<li>Then, delete <code data-end="450" data-start="433">nums[0..0] = [3]</code>, whose sum is 3 (divisible by 3), leaving <code data-end="502" data-start="497">[5]</code>.</li>
<li>The remaining sum is 5.<strong></strong></li>
<li>The remaining sum is 5.<strong></strong></li>
</ul>
</div>

View File

@@ -1,4 +1,4 @@
<p>You are given an <strong>undirected weighted</strong> tree with <code data-end="51" data-start="48">n</code> nodes, numbered from <code data-end="75" data-start="72">0</code> to <code data-end="86" data-start="79">n - 1</code>. It is represented by a 2D integer array <code data-end="129" data-start="122">edges</code> of length <code data-end="147" data-start="140">n - 1</code>, where <code data-end="185" data-start="160">edges[i] = [u<sub>i</sub>, v<sub>i</sub>, w<sub>i</sub>]</code> indicates that there is an edge between nodes <code data-end="236" data-start="232">u<sub>i</sub></code> and <code data-end="245" data-start="241">v<sub>i</sub></code> with weight <code data-end="262" data-start="258">w<sub>i</sub></code>.</p>
<p>You are given an <strong>undirected weighted</strong> tree with <code data-end="51" data-start="48">n</code> nodes, numbered from <code data-end="75" data-start="72">0</code> to <code data-end="86" data-start="79">n - 1</code>. It is represented by a 2D integer array <code data-end="129" data-start="122">edges</code> of length <code data-end="147" data-start="140">n - 1</code>, where <code data-end="185" data-start="160">edges[i] = [u<sub>i</sub>, v<sub>i</sub>, w<sub>i</sub>]</code> indicates that there is an edge between nodes <code data-end="236" data-start="232">u<sub>i</sub></code> and <code data-end="245" data-start="241">v<sub>i</sub></code> with weight <code data-end="262" data-start="258">w<sub>i</sub></code>.</p>
<p>Additionally, you are given a 2D integer array <code data-end="56" data-start="47">queries</code>, where <code data-end="105" data-start="69">queries[j] = [src1<sub>j</sub>, src2<sub>j</sub>, dest<sub>j</sub>]</code>.</p>

View File

@@ -43,7 +43,7 @@
<ul>
<li data-end="350" data-start="230">The first query <code data-end="257" data-start="246">[1, 4, 2, 3]</code> multiplies the elements at indices 1 and 3 by 3, transforming the array to <code data-end="347" data-start="333">[2, 9, 1, 15, 4]</code>.</li>
<li data-end="466" data-start="353">The second query <code data-end="381" data-start="370">[0, 2, 1, 2]</code> multiplies the elements at indices 0, 1, and 2 by 2, resulting in <code data-end="463" data-start="448">[4, 18, 2, 15, 4]</code>.</li>
<li data-end="532" data-is-last-node="" data-start="469">Finally, the XOR of all elements is <code data-end="531" data-start="505">4 ^ 18 ^ 2 ^ 15 ^ 4 = 31</code>.<strong></strong></li>
<li data-end="532" data-is-last-node="" data-start="469">Finally, the XOR of all elements is <code data-end="531" data-start="505">4 ^ 18 ^ 2 ^ 15 ^ 4 = 31</code>.<strong></strong></li>
</ul>
</div>

View File

@@ -44,7 +44,7 @@
<ul>
<li data-end="350" data-start="230">The first query <code data-end="257" data-start="246">[1, 4, 2, 3]</code> multiplies the elements at indices 1 and 3 by 3, transforming the array to <code data-end="347" data-start="333">[2, 9, 1, 15, 4]</code>.</li>
<li data-end="466" data-start="353">The second query <code data-end="381" data-start="370">[0, 2, 1, 2]</code> multiplies the elements at indices 0, 1, and 2 by 2, resulting in <code data-end="463" data-start="448">[4, 18, 2, 15, 4]</code>.</li>
<li data-end="532" data-is-last-node="" data-start="469">Finally, the XOR of all elements is <code data-end="531" data-start="505">4 ^ 18 ^ 2 ^ 15 ^ 4 = 31</code>.<strong></strong></li>
<li data-end="532" data-is-last-node="" data-start="469">Finally, the XOR of all elements is <code data-end="531" data-start="505">4 ^ 18 ^ 2 ^ 15 ^ 4 = 31</code>.<strong></strong></li>
</ul>
</div>
@@ -54,7 +54,7 @@
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= q == queries.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= q == queries.length &lt;= 10<sup>5</sup></code></li>
<li><code>queries[i] = [l<sub>i</sub>, r<sub>i</sub>, k<sub>i</sub>, v<sub>i</sub>]</code></li>
<li><code>0 &lt;= l<sub>i</sub> &lt;= r<sub>i</sub> &lt; n</code></li>
<li><code>1 &lt;= k<sub>i</sub> &lt;= n</code></li>

View File

@@ -20,7 +20,7 @@
</div>
<p><strong class="example">Example 2:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2025/07/20/gridexm2drawio.png" style="width: 350px; height: 68px;" />
<img alt="" src="https://assets.leetcode.com/uploads/2025/07/20/gridexm2drawio.png" style="width: 350px; height: 68px;" />
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">grid = [[3,4,2,3],[2,3,4,2]], x = 0, y = 2, k = 2</span></p>

View File

@@ -28,7 +28,7 @@ The <strong>average</strong> of an array is defined as the sum of all its elemen
<p><strong>Explanation:</strong></p>
<ul>
<li>The average of <code>nums</code> is <code>(-1 + 1 + 2) / 3 = 2 / 3 = 0.667</code>.</li>
<li>The average of <code>nums</code> is <code>(-1 + 1 + 2) / 3 = 2 / 3 = 0.667</code>.</li>
<li>The smallest absent positive integer greater than 0.667 is 3.</li>
</ul>
</div>
@@ -53,5 +53,5 @@ The <strong>average</strong> of an array is defined as the sum of all its elemen
<ul>
<li><code>1 &lt;= nums.length &lt;= 100</code></li>
<li><code>-100 &lt;= nums[i] &lt;= 100</code></li>
<li><code>-100 &lt;= nums[i] &lt;= 100</code></li>
</ul>

View File

@@ -50,5 +50,5 @@
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 1000</code></li>
<li><code>1 &lt;= n &lt;= 1000</code></li>
</ul>

View File

@@ -66,7 +66,7 @@
</tbody>
</table>
<p>Thus, the maximum possible profit is 10, which is achieved by modifying the subarray <code>[0, 1]</code>.</p>
<p>Thus, the maximum possible profit is 10, which is achieved by modifying the subarray <code>[0, 1]</code>.</p>
</div>
<p><strong class="example">Example 2:</strong></p>

View File

@@ -67,5 +67,5 @@
<ul>
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>
<li><code><sup></sup>1 &lt;= k &lt;= nums.length</code></li>
<li><code><sup></sup>1 &lt;= k &lt;= nums.length</code></li>
</ul>

View File

@@ -122,7 +122,7 @@
<p><strong>Explanation:</strong></p>
<p>One optimal activation order is:<strong></strong></p>
<p>One optimal activation order is:<strong></strong></p>
<table style="border: 1px solid black;">
<thead>
@@ -189,6 +189,6 @@
<ul>
<li><code>1 &lt;= n == value.length == limit.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= value[i] &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= value[i] &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= limit[i] &lt;= n</code></li>
</ul>

View File

@@ -52,7 +52,7 @@
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 5 * 10<sup>4</sup></code></li>
<li><code>1 &lt;= n == nums.length &lt;= 5 * 10<sup>4</sup></code></li>
<li><code>0 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= k &lt;= 10<sup>5</sup></code></li>
</ul>

View File

@@ -52,7 +52,7 @@
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 5 * 10<sup>4</sup></code></li>
<li><code>1 &lt;= n == nums.length &lt;= 5 * 10<sup>4</sup></code></li>
<li><code>0 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= k &lt;= min(10<sup>5</sup>, n * (n + 1) / 2)</code></li>
</ul>

View File

@@ -34,7 +34,7 @@
<p><strong>Output:</strong> <span class="example-io">9</span></p>
<p><strong>Explanation:</strong></p>
<p><strong>Explanation:</strong></p>
<ul>
<li data-end="181" data-start="145">Plan A (land ride 0 &rarr; water ride 0):
@@ -73,7 +73,7 @@
<p><strong>Output:</strong> <span class="example-io">14</span></p>
<p><strong>Explanation:</strong></p>
<p><strong>Explanation:</strong></p>
<ul data-end="1589" data-start="1086">
<li data-end="1124" data-start="1088">Plan A (water ride 0 &rarr; land ride 0):
@@ -90,7 +90,7 @@
</li>
</ul>
<p data-end="1640" data-is-last-node="" data-is-only-node="" data-start="1591">Plan A provides the earliest finish time of 14.<strong></strong></p>
<p data-end="1640" data-is-last-node="" data-is-only-node="" data-start="1591">Plan A provides the earliest finish time of 14.<strong></strong></p>
</div>
<p>&nbsp;</p>

View File

@@ -34,7 +34,7 @@
<p><strong>Output:</strong> <span class="example-io">9</span></p>
<p><strong>Explanation:</strong></p>
<p><strong>Explanation:</strong></p>
<ul>
<li data-end="181" data-start="145">Plan A (land ride 0 &rarr; water ride 0):
@@ -73,7 +73,7 @@
<p><strong>Output:</strong> <span class="example-io">14</span></p>
<p><strong>Explanation:</strong></p>
<p><strong>Explanation:</strong></p>
<ul data-end="1589" data-start="1086">
<li data-end="1124" data-start="1088">Plan A (water ride 0 &rarr; land ride 0):
@@ -90,7 +90,7 @@
</li>
</ul>
<p data-end="1640" data-is-last-node="" data-is-only-node="" data-start="1591">Plan A provides the earliest finish time of 14.<strong></strong></p>
<p data-end="1640" data-is-last-node="" data-is-only-node="" data-start="1591">Plan A provides the earliest finish time of 14.<strong></strong></p>
</div>
<p>&nbsp;</p>

View File

@@ -20,7 +20,7 @@
<p><strong>Explanation:</strong></p>
<p>Since each team plays every other team exactly twice, a total of 6 matches need to be played: <code>[0,1],[0,2],[1,2],[1,0],[2,0],[2,1]</code>.</p>
<p>Since each team plays every other team exactly twice, a total of 6 matches need to be played: <code>[0,1],[0,2],[1,2],[1,0],[2,0],[2,1]</code>.</p>
<p>It&#39;s not possible to create a schedule without at least one team playing consecutive days.</p>
</div>
@@ -43,5 +43,5 @@
<p><strong>Constraints:</strong></p>
<ul>
<li><code>2 &lt;= n &lt;= 50</code></li>
<li><code>2 &lt;= n &lt;= 50</code></li>
</ul>

View File

@@ -41,7 +41,7 @@ If the first <code>min(a.length, b.length)</code> characters do not differ, then
<p><strong>Explanation:</strong></p>
<ul>
<li><strong></strong>Remove <code>&quot;cd&quot;</code> from the string, leaving <code>&quot;ba&quot;</code> as the remaining string.</li>
<li><strong></strong>Remove <code>&quot;cd&quot;</code> from the string, leaving <code>&quot;ba&quot;</code> as the remaining string.</li>
<li>Remove <code>&quot;ba&quot;</code> from the string, leaving <code>&quot;&quot;</code> as the remaining string.</li>
<li>No further operations are possible. Thus, the lexicographically smallest string after all possible removals is <code>&quot;&quot;</code>.</li>
</ul>

View File

@@ -42,5 +42,5 @@
<ul>
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>
</ul>

View File

@@ -39,7 +39,7 @@
<p><strong>Explanation:</strong></p>
<ul>
<li>The string <code>&quot;a&quot;</code> only consists of <code>&#39;a&#39;</code> characters. Thus, the answer is 0.</li>
<li>The string <code>&quot;a&quot;</code> only consists of <code>&#39;a&#39;</code> characters. Thus, the answer is 0.</li>
</ul>
</div>