Skip to content

Commit 880901c

Browse files
authored
feat: update lc problems (#3961)
1 parent 58c2190 commit 880901c

File tree

40 files changed

+177
-145
lines changed

40 files changed

+177
-145
lines changed

solution/0400-0499/0480.Sliding Window Median/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ tags:
3636
<pre>
3737
<strong>Input:</strong> nums = [1,3,-1,-3,5,3,6,7], k = 3
3838
<strong>Output:</strong> [1.00000,-1.00000,-1.00000,3.00000,5.00000,6.00000]
39-
<strong>Explanation:</strong>
39+
<strong>Explanation:</strong>
4040
Window position Median
4141
--------------- -----
4242
[<strong>1 3 -1</strong>] -3 5 3 6 7 1

solution/0500-0599/0588.Design In-Memory File System/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ fileSystem.readContentFromFile("/a/b/c/d"); // 返回 "hello"</pre>
7777
<li><code>path</code>&nbsp;和&nbsp;<code>filePath</code>&nbsp;都是绝对路径,除非是根目录&nbsp;<code>‘/’</code>&nbsp;自身,其他路径都是以&nbsp;<code>‘/’</code>&nbsp;开头且 <strong>不</strong> 以&nbsp;<code>‘/’</code>&nbsp;结束。</li>
7878
<li>你可以假定所有操作的参数都是有效的,即用户不会获取不存在文件的内容,或者获取不存在文件夹和文件的列表。</li>
7979
<li>你可以假定所有文件夹名字和文件名字都只包含小写字母,且同一文件夹下不会有相同名字的文件夹或文件。</li>
80+
<li>你可以假定&nbsp;<code>addContentToFile</code> 中的文件的父目录都存在。</li>
8081
<li><code>1 &lt;= content.length &lt;= 50</code></li>
8182
<li><code>ls</code>,&nbsp;<code>mkdir</code>,&nbsp;<code>addContentToFile</code>, and&nbsp;<code>readContentFromFile</code>&nbsp;最多被调用&nbsp;<code>300</code>&nbsp;次</li>
8283
</ul>

solution/0700-0799/0731.My Calendar II/README_EN.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ tags:
4646

4747
<strong>Explanation</strong>
4848
MyCalendarTwo myCalendarTwo = new MyCalendarTwo();
49-
myCalendarTwo.book(10, 20); // return True, The event can be booked.
50-
myCalendarTwo.book(50, 60); // return True, The event can be booked.
51-
myCalendarTwo.book(10, 40); // return True, The event can be double booked.
49+
myCalendarTwo.book(10, 20); // return True, The event can be booked.
50+
myCalendarTwo.book(50, 60); // return True, The event can be booked.
51+
myCalendarTwo.book(10, 40); // return True, The event can be double booked.
5252
myCalendarTwo.book(5, 15); // return False, The event cannot be booked, because it would result in a triple booking.
5353
myCalendarTwo.book(5, 10); // return True, The event can be booked, as it does not use time 10 which is already double booked.
5454
myCalendarTwo.book(25, 55); // return True, The event can be booked, as the time in [25, 40) will be double booked with the third event, the time [40, 50) will be single booked, and the time [50, 55) will be double booked with the second event.

solution/0900-0999/0916.Word Subsets/README.md

+16-27
Original file line numberDiff line numberDiff line change
@@ -28,47 +28,36 @@ tags:
2828

2929
<p>如果对 <code>words2</code> 中的每一个单词&nbsp;<code>b</code>,<code>b</code> 都是 <code>a</code> 的子集,那么我们称&nbsp;<code>words1</code> 中的单词 <code>a</code> 是<em> </em><strong>通用单词</strong><em> </em>。</p>
3030

31-
<p>以数组形式返回&nbsp;<code>words1</code> 中所有的通用单词。你可以按 <strong>任意顺序</strong> 返回答案。</p>
31+
<p>以数组形式返回&nbsp;<code>words1</code> 中所有的 <strong>通用</strong> 单词。你可以按 <strong>任意顺序</strong> 返回答案。</p>
3232

3333
<p>&nbsp;</p>
3434

3535
<ol>
3636
</ol>
3737

38-
<p><strong>示例 1:</strong></p>
38+
<p><strong class="example">示例 1:</strong></p>
3939

40-
<pre>
41-
<strong>输入:</strong>words1 = ["amazon","apple","facebook","google","leetcode"], words2 = ["e","o"]
42-
<strong>输出:</strong>["facebook","google","leetcode"]
43-
</pre>
40+
<div class="example-block">
41+
<p><span class="example-io"><b>输入:</b>words1 = ["amazon","apple","facebook","google","leetcode"], words2 = ["e","o"]</span></p>
4442

45-
<p><strong>示例 2:</strong></p>
43+
<p><span class="example-io"><b>输出:</b>["facebook","google","leetcode"]</span></p>
44+
</div>
4645

47-
<pre>
48-
<strong>输入:</strong>words1 = ["amazon","apple","facebook","google","leetcode"], words2 = ["l","e"]
49-
<strong>输出:</strong>["apple","google","leetcode"]
50-
</pre>
46+
<p><strong class="example">示例 2:</strong></p>
5147

52-
<p><strong>示例 3:</strong></p>
48+
<div class="example-block">
49+
<p><span class="example-io"><b>输入:</b></span><span class="example-io">words1 = ["amazon","apple","facebook","google","leetcode"], words2 = ["lc","eo"]</span></p>
5350

54-
<pre>
55-
<strong>输入:</strong>words1 = ["amazon","apple","facebook","google","leetcode"], words2 = ["e","oo"]
56-
<strong>输出:</strong>["facebook","google"]
57-
</pre>
51+
<p><span class="example-io"><b>输出:</b></span><span class="example-io">["leetcode"]</span></p>
52+
</div>
5853

59-
<p><strong>示例 4:</strong></p>
54+
<p><strong class="example">示例 3:</strong></p>
6055

61-
<pre>
62-
<strong>输入:</strong>words1 = ["amazon","apple","facebook","google","leetcode"], words2 = ["lo","eo"]
63-
<strong>输出:</strong>["google","leetcode"]
64-
</pre>
56+
<div class="example-block">
57+
<p><span class="example-io"><b>输入:</b></span><span class="example-io">words1 = ["acaac","cccbb","aacbb","caacc","bcbbb"], words2 = ["c","cc","b"]</span></p>
6558

66-
<p><strong>示例 5:</strong></p>
67-
68-
<pre>
69-
<strong>输入:</strong>words1 = ["amazon","apple","facebook","google","leetcode"], words2 = ["ec","oc","ceo"]
70-
<strong>输出:</strong>["facebook","leetcode"]
71-
</pre>
59+
<p><span class="example-io"><b>输出:</b></span><span class="example-io">["cccbb"]</span></p>
60+
</div>
7261

7362
<p>&nbsp;</p>
7463

solution/0900-0999/0975.Odd Even Jump/README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ tags:
4040
<pre>
4141
<strong>Input:</strong> arr = [10,13,12,14,15]
4242
<strong>Output:</strong> 2
43-
<strong>Explanation:</strong>
43+
<strong>Explanation:</strong>
4444
From starting index i = 0, we can make our 1st jump to i = 2 (since arr[2] is the smallest among arr[1], arr[2], arr[3], arr[4] that is greater or equal to arr[0]), then we cannot jump any more.
4545
From starting index i = 1 and i = 2, we can make our 1st jump to i = 3, then we cannot jump any more.
4646
From starting index i = 3, we can make our 1st jump to i = 4, so we have reached the end.
@@ -54,7 +54,7 @@ jumps.
5454
<pre>
5555
<strong>Input:</strong> arr = [2,3,1,1,4]
5656
<strong>Output:</strong> 3
57-
<strong>Explanation:</strong>
57+
<strong>Explanation:</strong>
5858
From starting index i = 0, we make jumps to i = 1, i = 2, i = 3:
5959
During our 1st jump (odd-numbered), we first jump to i = 1 because arr[1] is the smallest value in [arr[1], arr[2], arr[3], arr[4]] that is greater than or equal to arr[0].
6060
During our 2nd jump (even-numbered), we jump from i = 1 to i = 2 because arr[2] is the largest value in [arr[2], arr[3], arr[4]] that is less than or equal to arr[1]. arr[3] is also the largest value, but 2 is a smaller index, so we can only jump to i = 2 and not i = 3

solution/1100-1199/1172.Dinner Plate Stacks/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ D.popAtStack(0); // 返回 20。栈的现状为: 4 21
6565
﹈ ﹈ ﹈
6666
D.popAtStack(2); // 返回 21。栈的现状为: 4
6767
&nbsp; 1 &nbsp;3 &nbsp;5
68-
﹈ ﹈ ﹈
68+
﹈ ﹈ ﹈
6969
D.pop() // 返回 5。栈的现状为: 4
70-
&nbsp; 1 &nbsp;3
71-
﹈ ﹈
72-
D.pop() // 返回 4。栈的现状为: 1 3
73-
﹈ ﹈
74-
D.pop() // 返回 3。栈的现状为: 1
75-
70+
&nbsp; 1 &nbsp;3
71+
﹈ ﹈
72+
D.pop() // 返回 4。栈的现状为: 1 3
73+
﹈ ﹈
74+
D.pop() // 返回 3。栈的现状为: 1
75+
7676
D.pop() // 返回 1。现在没有栈。
7777
D.pop() // 返回 -1。仍然没有栈。
7878
</pre>

solution/1100-1199/1172.Dinner Plate Stacks/README_EN.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ tags:
4242
<strong>Output</strong>
4343
[null, null, null, null, null, null, 2, null, null, 20, 21, 5, 4, 3, 1, -1]
4444

45-
<strong>Explanation:</strong>
45+
<strong>Explanation:</strong>
4646
DinnerPlates D = DinnerPlates(2); // Initialize with capacity = 2
4747
D.push(1);
4848
D.push(2);
@@ -65,14 +65,14 @@ D.popAtStack(0); // Returns 20. The stacks are now: 4 21
6565
﹈ ﹈ ﹈
6666
D.popAtStack(2); // Returns 21. The stacks are now: 4
6767
1 3 5
68-
﹈ ﹈ ﹈
68+
﹈ ﹈ ﹈
6969
D.pop() // Returns 5. The stacks are now: 4
70-
1 3
71-
﹈ ﹈
72-
D.pop() // Returns 4. The stacks are now: 1 3
73-
﹈ ﹈
74-
D.pop() // Returns 3. The stacks are now: 1
75-
70+
1 3
71+
﹈ ﹈
72+
D.pop() // Returns 4. The stacks are now: 1 3
73+
﹈ ﹈
74+
D.pop() // Returns 3. The stacks are now: 1
75+
7676
D.pop() // Returns 1. There are no stacks.
7777
D.pop() // Returns -1. There are still no stacks.
7878
</pre>

solution/1300-1399/1348.Tweet Counts Per Frequency/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ tweetCounts.recordTweet("tweet3", 0);
6868
tweetCounts.recordTweet("tweet3", 60);
6969
tweetCounts.recordTweet("tweet3", 10); //&nbsp;"tweet3"&nbsp;发布推文的时间分别是&nbsp;0,&nbsp;10&nbsp;&nbsp;60 。
7070
tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 59); //&nbsp;返回&nbsp;[2]。统计频率是每分钟(60 秒),因此只有一个有效时间间隔 [0,60&gt;&nbsp;-&nbsp;&gt;&nbsp;2&nbsp;条推文。
71-
tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 60); //&nbsp;返回&nbsp;[2,1]。统计频率是每分钟(60 秒),因此有两个有效时间间隔&nbsp;<strong>1)</strong>&nbsp;[0,60&gt;&nbsp;-&nbsp;&gt;&nbsp;2&nbsp;条推文,和&nbsp;<strong>2)</strong>&nbsp;[60,61&gt;&nbsp;-&nbsp;&gt;&nbsp;1&nbsp;条推文。
71+
tweetCounts.getTweetCountsPerFrequency("minute", "tweet3", 0, 60); //&nbsp;返回&nbsp;[2,1]。统计频率是每分钟(60 秒),因此有两个有效时间间隔&nbsp;<strong>1)</strong>&nbsp;[0,60&gt;&nbsp;-&nbsp;&gt;&nbsp;2&nbsp;条推文,和&nbsp;<strong>2)</strong>&nbsp;[60,61&gt;&nbsp;-&nbsp;&gt;&nbsp;1&nbsp;条推文。
7272
tweetCounts.recordTweet("tweet3", 120); // "tweet3"&nbsp;发布推文的时间分别是 0, 10, 60 和 120 。
7373
tweetCounts.getTweetCountsPerFrequency("hour", "tweet3", 0, 210); //&nbsp;返回&nbsp;[4]。统计频率是每小时(3600 秒),因此只有一个有效时间间隔 [0,211&gt;&nbsp;-&nbsp;&gt;&nbsp;4&nbsp;条推文。
7474
</pre>

solution/1400-1499/1400.Construct K Palindrome Strings/README.md

+7-23
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tags:
2121

2222
<!-- description:start -->
2323

24-
<p>给你一个字符串 <code>s</code>&nbsp;和一个整数 <code>k</code>&nbsp;。请你用 <code>s</code>&nbsp;字符串中 <strong>所有字符</strong>&nbsp;构造 <code>k</code>&nbsp;个非空 <strong>回文串</strong>&nbsp;。</p>
24+
<p>给你一个字符串 <code>s</code>&nbsp;和一个整数 <code>k</code>&nbsp;。请你用 <code>s</code>&nbsp;字符串中 <strong>所有字符</strong>&nbsp;构造 <code>k</code>&nbsp;个非空 <span data-keyword="palindrome-string">回文串</span>&nbsp;。</p>
2525

2626
<p>如果你可以用&nbsp;<code>s</code>&nbsp;中所有字符构造&nbsp;<code>k</code>&nbsp;个回文字符串,那么请你返回 <strong>True</strong>&nbsp;,否则返回&nbsp;<strong>False</strong>&nbsp;。</p>
2727

@@ -30,52 +30,36 @@ tags:
3030
<p><strong>示例 1:</strong></p>
3131

3232
<pre>
33-
<strong>输入:</strong>s = &quot;annabelle&quot;, k = 2
33+
<strong>输入:</strong>s = "annabelle", k = 2
3434
<strong>输出:</strong>true
3535
<strong>解释:</strong>可以用 s 中所有字符构造 2 个回文字符串。
36-
一些可行的构造方案包括:&quot;anna&quot; + &quot;elble&quot;&quot;anbna&quot; + &quot;elle&quot;&quot;anellena&quot; + &quot;b&quot;
36+
一些可行的构造方案包括:"anna" + "elble","anbna" + "elle","anellena" + "b"
3737
</pre>
3838

3939
<p><strong>示例 2:</strong></p>
4040

4141
<pre>
42-
<strong>输入:</strong>s = &quot;leetcode&quot;, k = 3
42+
<strong>输入:</strong>s = "leetcode", k = 3
4343
<strong>输出:</strong>false
4444
<strong>解释:</strong>无法用 s 中所有字符构造 3 个回文串。
4545
</pre>
4646

4747
<p><strong>示例 3:</strong></p>
4848

4949
<pre>
50-
<strong>输入:</strong>s = &quot;true&quot;, k = 4
50+
<strong>输入:</strong>s = "true", k = 4
5151
<strong>输出:</strong>true
5252
<strong>解释:</strong>唯一可行的方案是让 s 中每个字符单独构成一个字符串。
5353
</pre>
5454

55-
<p><strong>示例 4:</strong></p>
56-
57-
<pre>
58-
<strong>输入:</strong>s = &quot;yzyzyzyzyzyzyzy&quot;, k = 2
59-
<strong>输出:</strong>true
60-
<strong>解释:</strong>你只需要将所有的 z 放在一个字符串中,所有的 y 放在另一个字符串中。那么两个字符串都是回文串。
61-
</pre>
62-
63-
<p><strong>示例 5:</strong></p>
64-
65-
<pre>
66-
<strong>输入:</strong>s = &quot;cr&quot;, k = 7
67-
<strong>输出:</strong>false
68-
<strong>解释:</strong>我们没有足够的字符去构造 7 个回文串。
69-
</pre>
70-
7155
<p>&nbsp;</p>
7256

7357
<p><strong>提示:</strong></p>
7458

7559
<ul>
76-
<li><code>1 &lt;= s.length &lt;= 10^5</code></li>
60+
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
7761
<li><code>s</code>&nbsp;中所有字符都是小写英文字母。</li>
78-
<li><code>1 &lt;= k &lt;= 10^5</code></li>
62+
<li><code>1 &lt;= k &lt;= 10<sup>5</sup></code></li>
7963
</ul>
8064

8165
<!-- description:end -->

solution/1400-1499/1438.Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,25 @@ tags:
3232
<p><strong>示例 1:</strong></p>
3333

3434
<pre><strong>输入:</strong>nums = [8,2,4,7], limit = 4
35-
<strong>输出:</strong>2
35+
<strong>输出:</strong>2
3636
<strong>解释:</strong>所有子数组如下:
3737
[8] 最大绝对差 |8-8| = 0 &lt;= 4.
38-
[8,2] 最大绝对差 |8-2| = 6 &gt; 4.
38+
[8,2] 最大绝对差 |8-2| = 6 &gt; 4.
3939
[8,2,4] 最大绝对差 |8-2| = 6 &gt; 4.
4040
[8,2,4,7] 最大绝对差 |8-2| = 6 &gt; 4.
4141
[2] 最大绝对差 |2-2| = 0 &lt;= 4.
4242
[2,4] 最大绝对差 |2-4| = 2 &lt;= 4.
4343
[2,4,7] 最大绝对差 |2-7| = 5 &gt; 4.
4444
[4] 最大绝对差 |4-4| = 0 &lt;= 4.
4545
[4,7] 最大绝对差 |4-7| = 3 &lt;= 4.
46-
[7] 最大绝对差 |7-7| = 0 &lt;= 4.
46+
[7] 最大绝对差 |7-7| = 0 &lt;= 4.
4747
因此,满足题意的最长子数组的长度为 2 。
4848
</pre>
4949

5050
<p><strong>示例 2:</strong></p>
5151

5252
<pre><strong>输入:</strong>nums = [10,1,2,4,7,2], limit = 5
53-
<strong>输出:</strong>4
53+
<strong>输出:</strong>4
5454
<strong>解释:</strong>满足题意的最长子数组是 [2,4,7,2],其最大绝对差 |2-7| = 5 &lt;= 5 。
5555
</pre>
5656

solution/1400-1499/1438.Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit/README_EN.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,26 @@ tags:
3030

3131
<pre>
3232
<strong>Input:</strong> nums = [8,2,4,7], limit = 4
33-
<strong>Output:</strong> 2
34-
<strong>Explanation:</strong> All subarrays are:
33+
<strong>Output:</strong> 2
34+
<strong>Explanation:</strong> All subarrays are:
3535
[8] with maximum absolute diff |8-8| = 0 &lt;= 4.
36-
[8,2] with maximum absolute diff |8-2| = 6 &gt; 4.
36+
[8,2] with maximum absolute diff |8-2| = 6 &gt; 4.
3737
[8,2,4] with maximum absolute diff |8-2| = 6 &gt; 4.
3838
[8,2,4,7] with maximum absolute diff |8-2| = 6 &gt; 4.
3939
[2] with maximum absolute diff |2-2| = 0 &lt;= 4.
4040
[2,4] with maximum absolute diff |2-4| = 2 &lt;= 4.
4141
[2,4,7] with maximum absolute diff |2-7| = 5 &gt; 4.
4242
[4] with maximum absolute diff |4-4| = 0 &lt;= 4.
4343
[4,7] with maximum absolute diff |4-7| = 3 &lt;= 4.
44-
[7] with maximum absolute diff |7-7| = 0 &lt;= 4.
44+
[7] with maximum absolute diff |7-7| = 0 &lt;= 4.
4545
Therefore, the size of the longest subarray is 2.
4646
</pre>
4747

4848
<p><strong class="example">Example 2:</strong></p>
4949

5050
<pre>
5151
<strong>Input:</strong> nums = [10,1,2,4,7,2], limit = 5
52-
<strong>Output:</strong> 4
52+
<strong>Output:</strong> 4
5353
<strong>Explanation:</strong> The subarray [2,4,7,2] is the longest since the maximum absolute diff is |2-7| = 5 &lt;= 5.
5454
</pre>
5555

solution/1600-1699/1606.Find Servers That Handled Most Number of Requests/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ tags:
4141
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1600-1699/1606.Find%20Servers%20That%20Handled%20Most%20Number%20of%20Requests/images/load-1.png" style="height: 221px; width: 389px;" /></p>
4242

4343
<pre>
44-
<strong>输入:</strong>k = 3, arrival = [1,2,3,4,5], load = [5,2,3,3,3]
45-
<strong>输出:</strong>[1]
44+
<strong>输入:</strong>k = 3, arrival = [1,2,3,4,5], load = [5,2,3,3,3]
45+
<strong>输出:</strong>[1]
4646
<strong>解释:</strong>
4747
所有服务器一开始都是空闲的。
4848
前 3 个请求分别由前 3 台服务器依次处理。

solution/1600-1699/1606.Find Servers That Handled Most Number of Requests/README_EN.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ tags:
3838
<p><strong class="example">Example 1:</strong></p>
3939
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1600-1699/1606.Find%20Servers%20That%20Handled%20Most%20Number%20of%20Requests/images/load-1.png" style="width: 389px; height: 221px;" />
4040
<pre>
41-
<strong>Input:</strong> k = 3, arrival = [1,2,3,4,5], load = [5,2,3,3,3]
42-
<strong>Output:</strong> [1]
43-
<strong>Explanation:</strong>
41+
<strong>Input:</strong> k = 3, arrival = [1,2,3,4,5], load = [5,2,3,3,3]
42+
<strong>Output:</strong> [1]
43+
<strong>Explanation:</strong>
4444
All of the servers start out available.
4545
The first 3 requests are handled by the first 3 servers in order.
4646
Request 3 comes in. Server 0 is busy, so it&#39;s assigned to the next available server, which is 1.
@@ -53,7 +53,7 @@ Servers 0 and 2 handled one request each, while server 1 handled two requests. H
5353
<pre>
5454
<strong>Input:</strong> k = 3, arrival = [1,2,3,4], load = [1,2,1,2]
5555
<strong>Output:</strong> [0]
56-
<strong>Explanation:</strong>
56+
<strong>Explanation:</strong>
5757
The first 3 requests are handled by first 3 servers.
5858
Request 3 comes in. It is handled by server 0 since the server is available.
5959
Server 0 handled two requests, while servers 1 and 2 handled one request each. Hence server 0 is the busiest server.

solution/1800-1899/1825.Finding MK Average/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ tags:
5252
[null, null, null, -1, null, 3, null, null, null, 5]
5353

5454
<strong>解释:</strong>
55-
MKAverage obj = new MKAverage(3, 1);
55+
MKAverage obj = new MKAverage(3, 1);
5656
obj.addElement(3); // 当前元素为 [3]
5757
obj.addElement(1); // 当前元素为 [3,1]
5858
obj.calculateMKAverage(); // 返回 -1 ,因为 m = 3 ,但数据流中只有 2 个元素

solution/1800-1899/1825.Finding MK Average/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ tags:
5151
[null, null, null, -1, null, 3, null, null, null, 5]
5252

5353
<strong>Explanation</strong>
54-
<code>MKAverage obj = new MKAverage(3, 1);
54+
<code>MKAverage obj = new MKAverage(3, 1);
5555
obj.addElement(3); // current elements are [3]
5656
obj.addElement(1); // current elements are [3,1]
5757
obj.calculateMKAverage(); // return -1, because m = 3 and only 2 elements exist.

solution/2300-2399/2349.Design a Number Container System/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ nc.change(1, 10); // Your container at index 1 will be filled with number 10.
5454
nc.change(3, 10); // Your container at index 3 will be filled with number 10.
5555
nc.change(5, 10); // Your container at index 5 will be filled with number 10.
5656
nc.find(10); // Number 10 is at the indices 1, 2, 3, and 5. Since the smallest index that is filled with 10 is 1, we return 1.
57-
nc.change(1, 20); // Your container at index 1 will be filled with number 20. Note that index 1 was filled with 10 and then replaced with 20.
57+
nc.change(1, 20); // Your container at index 1 will be filled with number 20. Note that index 1 was filled with 10 and then replaced with 20.
5858
nc.find(10); // Number 10 is at the indices 2, 3, and 5. The smallest index that is filled with 10 is 2. Therefore, we return 2.
5959
</pre>
6060

0 commit comments

Comments
 (0)