Skip to content

Commit a4f0b14

Browse files
authored
feat: update lc problems (doocs#2566)
1 parent 204e0bf commit a4f0b14

File tree

13 files changed

+40
-39
lines changed

13 files changed

+40
-39
lines changed

solution/3000-3099/3082.Find the Sum of the Power of All Subsequences/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
<p>总共有&nbsp;<code>5</code>&nbsp;个能量不为 0 的子序列:</p>
3131

3232
<ul>
33-
<li>子序列&nbsp;<code>[<em><strong>1</strong></em>,<em><strong>2</strong></em>,<em><strong>3</strong></em>]</code> 有&nbsp;<code>2</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[1,2,<strong><em>3</em></strong>]</code> 和 <code>[<strong><em>1</em></strong>,<strong><em>2</em></strong>,3]</code>&nbsp;。</li>
34-
<li>子序列&nbsp;<code>[<em><strong>1</strong></em>,2,<em><strong>3</strong></em>]</code>&nbsp;有 <code>1</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[1,2,<strong><em>3</em></strong>]</code>&nbsp;。</li>
35-
<li>子序列&nbsp;<code>[1,<em><strong>2</strong></em>,<em><strong>3</strong></em>]</code> 有&nbsp;<code>1</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[1,2,<strong><em>3</em></strong>]</code>&nbsp;。</li>
36-
<li>子序列&nbsp;<code>[<em><strong>1</strong></em>,<em><strong>2</strong></em>,3]</code>&nbsp;有&nbsp;<code>1</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[<strong><em>1</em></strong>,<strong><em>2</em></strong>,3]</code>&nbsp;。</li>
37-
<li>子序列&nbsp;<code>[1,2,<em><strong>3</strong></em>]</code>&nbsp;有&nbsp;<code>1</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[1,2,<strong><em>3</em></strong>]</code>&nbsp;。</li>
33+
<li>子序列&nbsp;<code>[<u><em><strong>1</strong></em></u>,<u><em><strong>2</strong></em></u>,<u><em><strong>3</strong></em></u>]</code> 有&nbsp;<code>2</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[1,2,<u><strong><em>3</em></strong></u>]</code> 和 <code>[<u><strong><em>1</em></strong></u>,<u><strong><em>2</em></strong></u>,3]</code>&nbsp;。</li>
34+
<li>子序列&nbsp;<code>[<u><em><strong>1</strong></em></u>,2,<u><em><strong>3</strong></em></u>]</code>&nbsp;有 <code>1</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[1,2,<u><strong><em>3</em></strong></u>]</code>&nbsp;。</li>
35+
<li>子序列&nbsp;<code>[1,<u><em><strong>2</strong></em></u>,<u><em><strong>3</strong></em></u>]</code> 有&nbsp;<code>1</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[1,2,<u><strong><em>3</em></strong></u>]</code>&nbsp;。</li>
36+
<li>子序列&nbsp;<code>[<u><em><strong>1</strong></em></u>,<u><em><strong>2</strong></em></u>,3]</code>&nbsp;有&nbsp;<code>1</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[<u><strong><em>1</em></strong></u>,<u><strong><em>2</em></strong></u>,3]</code>&nbsp;。</li>
37+
<li>子序列&nbsp;<code>[1,2,<u><em><strong>3</strong></em></u>]</code>&nbsp;有&nbsp;<code>1</code>&nbsp;个和为&nbsp;<code>3</code>&nbsp;的子序列:<code>[1,2,<u><strong><em>3</em></strong></u>]</code>&nbsp;。</li>
3838
</ul>
3939

4040
<p>所以答案为&nbsp;<code>2 + 1 + 1 + 1 + 1 = 6</code>&nbsp;。</p>
@@ -52,9 +52,9 @@
5252
<p>总共有&nbsp;<code>3</code>&nbsp;个能量不为 0 的子序列:</p>
5353

5454
<ul>
55-
<li>子序列&nbsp;<code>[<em><strong>2</strong></em>,<em><strong>3</strong></em>,<em><strong>3</strong></em>]</code>&nbsp;有 2 个子序列和为&nbsp;<code>5</code>&nbsp;:<code>[<strong><em>2</em></strong>,3,<strong><em>3</em></strong>]</code> 和&nbsp;<code>[<strong><em>2</em></strong>,<strong><em>3</em></strong>,3]</code>&nbsp;。</li>
56-
<li>子序列&nbsp;<code>[<em><strong>2</strong></em>,3,<em><strong>3</strong></em>]</code>&nbsp;有 1 个子序列和为&nbsp;<code>5</code>&nbsp;:<code>[<strong><em>2</em></strong>,3,<strong><em>3</em></strong>]</code>&nbsp;。</li>
57-
<li>子序列&nbsp;<code>[<em><strong>2</strong></em>,<em><strong>3</strong></em>,3]</code>&nbsp;有 1 个子序列和为 <code>5</code>&nbsp;:<code>[<strong><em>2</em></strong>,<strong><em>3</em></strong>,3]</code>&nbsp;。</li>
55+
<li>子序列&nbsp;<code>[<u><em><strong>2</strong></em></u>,<u><em><strong>3</strong></em></u>,<u><em><strong>3</strong></em></u>]</code>&nbsp;有 2 个子序列和为&nbsp;<code>5</code>&nbsp;:<code>[<u><strong><em>2</em></strong></u>,3,<u><strong><em>3</em></strong></u>]</code> 和&nbsp;<code>[<u><strong><em>2</em></strong></u>,<u><strong><em>3</em></strong></u>,3]</code>&nbsp;。</li>
56+
<li>子序列&nbsp;<code>[<u><em><strong>2</strong></em></u>,3,<u><em><strong>3</strong></em></u>]</code>&nbsp;有 1 个子序列和为&nbsp;<code>5</code>&nbsp;:<code>[<u><strong><em>2</em></strong></u>,3,<u><strong><em>3</em></strong></u>]</code>&nbsp;。</li>
57+
<li>子序列&nbsp;<code>[<u><em><strong>2</strong></em></u>,<u><em><strong>3</strong></em></u>,3]</code>&nbsp;有 1 个子序列和为 <code>5</code>&nbsp;:<code>[<u><strong><em>2</em></strong></u>,<u><strong><em>3</em></strong></u>,3]</code>&nbsp;。</li>
5858
</ul>
5959

6060
<p>所以答案为&nbsp;<code>2 + 1 + 1 = 4</code>&nbsp;。</p>

solution/3100-3199/3104.Find Longest Self-Contained Substring/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
[English Version](/solution/3100-3199/3104.Find%20Longest%20Self-Contained%20Substring/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:哈希表,字符串,二分查找,前缀和 -->
66

77
## 题目描述
88

99
<!-- 这里写题目描述 -->
1010

1111
<p>Given a string <code>s</code>, your task is to find the length of the <strong>longest self-contained</strong> <span data-keyword="substring-nonempty">substring</span> of <code>s</code>.</p>
1212

13-
<p>A substring <code>t</code> of a string <code>s</code> is considered <strong>self-contained </strong>if <code>t != s</code> and for every character in <code>t</code>, it doesn&#39;t exist in the <em>rest</em> of <code>s</code>.</p>
13+
<p>A substring <code>t</code> of a string <code>s</code> is called <strong>self-contained </strong>if <code>t != s</code> and for every character in <code>t</code>, it doesn&#39;t exist in the <em>rest</em> of <code>s</code>.</p>
1414

1515
<p>Return the length of the <em>longest<strong> </strong>self-contained </em>substring of <code>s</code> if it exists, otherwise, return -1.</p>
1616

solution/3100-3199/3104.Find Longest Self-Contained Substring/README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
[中文文档](/solution/3100-3199/3104.Find%20Longest%20Self-Contained%20Substring/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Hash Table,String,Binary Search,Prefix Sum -->
66

77
## Description
88

99
<p>Given a string <code>s</code>, your task is to find the length of the <strong>longest self-contained</strong> <span data-keyword="substring-nonempty">substring</span> of <code>s</code>.</p>
1010

11-
<p>A substring <code>t</code> of a string <code>s</code> is considered <strong>self-contained </strong>if <code>t != s</code> and for every character in <code>t</code>, it doesn&#39;t exist in the <em>rest</em> of <code>s</code>.</p>
11+
<p>A substring <code>t</code> of a string <code>s</code> is called <strong>self-contained </strong>if <code>t != s</code> and for every character in <code>t</code>, it doesn&#39;t exist in the <em>rest</em> of <code>s</code>.</p>
1212

1313
<p>Return the length of the <em>longest<strong> </strong>self-contained </em>substring of <code>s</code> if it exists, otherwise, return -1.</p>
1414

solution/3100-3199/3105.Longest Strictly Increasing or Strictly Decreasing Subarray/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3100-3199/3105.Longest%20Strictly%20Increasing%20or%20Strictly%20Decreasing%20Subarray/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:数组 -->
66

77
## 题目描述
88

solution/3100-3199/3105.Longest Strictly Increasing or Strictly Decreasing Subarray/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3100-3199/3105.Longest%20Strictly%20Increasing%20or%20Strictly%20Decreasing%20Subarray/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Array -->
66

77
## Description
88

solution/3100-3199/3106.Lexicographically Smallest String After Operations With Constraint/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3100-3199/3106.Lexicographically%20Smallest%20String%20After%20Operations%20With%20Constraint/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:贪心,字符串 -->
66

77
## 题目描述
88

solution/3100-3199/3106.Lexicographically Smallest String After Operations With Constraint/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3100-3199/3106.Lexicographically%20Smallest%20String%20After%20Operations%20With%20Constraint/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Greedy,String -->
66

77
## Description
88

solution/3100-3199/3107.Minimum Operations to Make Median of Array Equal to K/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22

33
[English Version](/solution/3100-3199/3107.Minimum%20Operations%20to%20Make%20Median%20of%20Array%20Equal%20to%20K/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:贪心,数组,排序 -->
66

77
## 题目描述
88

99
<!-- 这里写题目描述 -->
1010

11-
<p>给你一个整数数组&nbsp;<code>nums</code>&nbsp;和一个 <strong>非负</strong>&nbsp;整数&nbsp;<code>k</code>&nbsp;。</p>
12-
13-
<p>一次操作中,你可以选择任一下标&nbsp;<code>i</code>&nbsp;,然后将&nbsp;<code>nums[i]</code>&nbsp;&nbsp;<code>1</code>&nbsp;或者减&nbsp;<code>1</code>&nbsp;。</p>
11+
<p>给你一个整数数组&nbsp;<code>nums</code>&nbsp;和一个 <strong>非负</strong>&nbsp;整数&nbsp;<code>k</code>&nbsp;。一次操作中,你可以选择任一元素&nbsp;&nbsp;<code>1</code>&nbsp;或者减&nbsp;<code>1</code>&nbsp;。</p>
1412

1513
<p>请你返回将 <code>nums</code>&nbsp;<strong>中位数</strong>&nbsp;变为 <code>k</code>&nbsp;所需要的 <strong>最少</strong>&nbsp;操作次数。</p>
1614

17-
<p>一个数组的 <strong>中位数</strong>&nbsp;指的是数组按 <strong>非递减</strong> 顺序排序后最中间的元素。如果数组长度为偶数,我们选择中间两个数的较大值为中位数。</p>
15+
<p>一个数组的中位数指的是数组按非递减顺序排序后最中间的元素。如果数组长度为偶数,我们选择中间两个数的较大值为中位数。</p>
1816

1917
<p>&nbsp;</p>
2018

@@ -25,7 +23,7 @@
2523

2624
<p><span class="example-io"><b>输出:</b>2</span></p>
2725

28-
<p><b>解释:</b>我们将&nbsp;<code>nums[1]</code> 和&nbsp;<code>nums[4]</code>&nbsp;减 <code>1</code>&nbsp;得到&nbsp;<code>[2, 4, 6, 8, 4]</code>&nbsp;。现在数组的中位数等于&nbsp;<code>k</code>&nbsp;所以答案为 2 。</p>
26+
<p><b>解释:</b>我们将&nbsp;<code>nums[1]</code> 和&nbsp;<code>nums[4]</code>&nbsp;减 <code>1</code>&nbsp;得到&nbsp;<code>[2, 4, 6, 8, 4]</code>&nbsp;。现在数组的中位数等于&nbsp;<code>k</code>&nbsp;。</p>
2927
</div>
3028

3129
<p><strong class="example">示例 2:</strong></p>
@@ -35,7 +33,7 @@
3533

3634
<p><span class="example-io"><b>输出:</b>3</span></p>
3735

38-
<p><b>解释:</b>我们将&nbsp;<code>nums[1]</code>&nbsp;增加 1 两次,并且将&nbsp;<code>nums[2]</code>&nbsp;增加 1 一次,得到&nbsp;<code>[2, 7, 7, 8, 5]</code>&nbsp;结果数组的中位数等于&nbsp;<code>k</code>&nbsp;。所以答案为 3 。</p>
36+
<p><b>解释:</b>我们将&nbsp;<code>nums[1]</code>&nbsp;增加 1 两次,并且将&nbsp;<code>nums[2]</code>&nbsp;增加 1 一次,得到&nbsp;<code>[2, 7, 7, 8, 5]</code>&nbsp;。</p>
3937
</div>
4038

4139
<p><strong class="example">示例 3:</strong></p>
@@ -45,7 +43,7 @@
4543

4644
<p><span class="example-io"><b>输出:</b>0</span></p>
4745

48-
<p><b>解释:</b>数组中位数已经等于 <code>k</code>&nbsp;,所以不需要进行任何操作。</p>
46+
<p><b>解释:</b>数组中位数已经等于 <code>k</code>&nbsp;了。</p>
4947
</div>
5048

5149
<p>&nbsp;</p>

solution/3100-3199/3107.Minimum Operations to Make Median of Array Equal to K/README_EN.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22

33
[中文文档](/solution/3100-3199/3107.Minimum%20Operations%20to%20Make%20Median%20of%20Array%20Equal%20to%20K/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Greedy,Array,Sorting -->
66

77
## Description
88

99
<p>You are given an integer array <code>nums</code> and a <strong>non-negative</strong> integer <code>k</code>. In one operation, you can increase or decrease any element by 1.</p>
1010

11-
<p>Return the <strong>minimum</strong> number of operations needed to make the <strong><span data-keyword="median-array">median</span></strong> of <code>nums</code> <em>equal</em> to <code>k</code>.</p>
11+
<p>Return the <strong>minimum</strong> number of operations needed to make the <strong>median</strong> of <code>nums</code> <em>equal</em> to <code>k</code>.</p>
12+
13+
<p>The median of an array is defined as the middle element of the array when it is sorted in non-decreasing order. If there are two choices for a median, the larger of the two values is taken.</p>
1214

1315
<p>&nbsp;</p>
1416
<p><strong class="example">Example 1:</strong></p>

solution/3100-3199/3108.Minimum Cost Walk in Weighted Graph/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3100-3199/3108.Minimum%20Cost%20Walk%20in%20Weighted%20Graph/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:位运算,并查集,图,数组 -->
66

77
## 题目描述
88

0 commit comments

Comments
 (0)