Skip to content

Commit 574a854

Browse files
authored
feat: update lc problems (doocs#2099)
1 parent df32703 commit 574a854

File tree

22 files changed

+86
-105
lines changed

22 files changed

+86
-105
lines changed

solution/0000-0099/0038.Count and Say/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ countAndSay(4) = 读 "21" = 一 个 2 + 一 个 1 = "12" + "11" = "1211"
7373

7474
**方法一: 模拟**
7575

76-
题目要求输出第 $n$ 项的外观序列,而第 $n$ 项是序列中第 $n-1$ 项的描述。所以我们遍历 $n-1$ 次,每次迭代用快慢指针j和i,分别记录当前字符的位置以及下一个不等于当前字符的位置,更新上一项的序列为 $j-i$ 个当前字符。
76+
题目要求输出第 $n$ 项的外观序列,而第 $n$ 项是序列中第 $n-1$ 项的描述。所以我们遍历 $n-1$ 次,每次迭代用快慢指针 j 和 i,分别记录当前字符的位置以及下一个不等于当前字符的位置,更新上一项的序列为 $j-i$ 个当前字符。
7777

7878
时间复杂度:
7979

solution/0200-0299/0274.H-Index/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<p>给你一个整数数组 <code>citations</code> ,其中 <code>citations[i]</code> 表示研究者的第 <code>i</code> 篇论文被引用的次数。计算并返回该研究者的 <strong><code>h</code><em>&nbsp;</em>指数</strong>。</p>
1010

11-
<p>根据维基百科上&nbsp;<a href="https://baike.baidu.com/item/h-index/3991452?fr=aladdin" target="_blank">h 指数的定义</a>:<code>h</code> 代表“高引用次数” ,一名科研人员的 <code>h</code><strong> 指数 </strong>是指他(她)至少发表了 <code>h</code> 篇论文,并且每篇论文<strong> 至少</strong> 被引用 <code>h</code> 。如果 <code>h</code><em> </em>有多种可能的值,<strong><code>h</code> 指数 </strong>是其中最大的那个。</p>
11+
<p>根据维基百科上&nbsp;<a href="https://baike.baidu.com/item/h-index/3991452?fr=aladdin" target="_blank">h 指数的定义</a>:<code>h</code> 代表“高引用次数” ,一名科研人员的 <code>h</code><strong> 指数 </strong>是指他(她)至少发表了 <code>h</code> 篇论文,并且&nbsp;<strong>至少&nbsp;</strong>有 <code>h</code> 篇论文被引用次数大于等于 <code>h</code> 。如果 <code>h</code><em> </em>有多种可能的值,<strong><code>h</code> 指数 </strong>是其中最大的那个。</p>
1212

1313
<p>&nbsp;</p>
1414

solution/0300-0399/0373.Find K Pairs with Smallest Sums/README_EN.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<li><code>-10<sup>9</sup> &lt;= nums1[i], nums2[i] &lt;= 10<sup>9</sup></code></li>
4444
<li><code>nums1</code> and <code>nums2</code> both are sorted in <strong>non-decreasing order</strong>.</li>
4545
<li><code>1 &lt;= k &lt;= 10<sup>4</sup></code></li>
46+
<li><code>k &lt;=&nbsp;nums1.length *&nbsp;nums2.length</code></li>
4647
</ul>
4748

4849
## Solutions

solution/0500-0599/0511.Game Play Analysis I/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<p>&nbsp;</p>
2626

27-
<p>查询每位玩家 <strong>第一次登陆平台的日期</strong>。</p>
27+
<p>查询每位玩家 <strong>第一次登录平台的日期</strong>。</p>
2828

2929
<p>查询结果的格式如下所示:</p>
3030

solution/0500-0599/0598.Range Addition II/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# [598. 范围求和 II](https://leetcode.cn/problems/range-addition-ii)
1+
# [598. 区间加法 II](https://leetcode.cn/problems/range-addition-ii)
22

33
[English Version](/solution/0500-0599/0598.Range%20Addition%20II/README_EN.md)
44

55
## 题目描述
66

77
<!-- 这里写题目描述 -->
88

9-
<p>给你一个 <code>m x&nbsp;n</code> 的矩阵&nbsp;<code>M</code><strong>&nbsp;</strong>,初始化时所有的 <code>0</code> 和一个操作数组 <code>op</code> ,其中 <code>ops[i] = [ai, bi]</code> 意味着当所有的 <code>0 &lt;= x &lt; ai</code> 和 <code>0 &lt;= y &lt; bi</code> 时, <code>M[x][y]</code> 应该加 1。</p>
9+
<p>给你一个 <code>m x&nbsp;n</code> 的矩阵&nbsp;<code>M</code><strong> </strong>和一个操作数组 <code>op</code> 。矩阵初始化时所有的单元格都为 <code>0</code> <code>ops[i] = [ai, bi]</code> 意味着当所有的 <code>0 &lt;= x &lt; ai</code> 和 <code>0 &lt;= y &lt; bi</code> 时, <code>M[x][y]</code> 应该加 1。</p>
1010

1111
<p>在&nbsp;<em>执行完所有操作后</em>&nbsp;,计算并返回&nbsp;<em>矩阵中最大整数的个数</em>&nbsp;。</p>
1212

solution/0600-0699/0663.Equal Tree Partition/README.md

+18-42
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,33 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>给定一棵有 <code>n</code> 个结点的二叉树,你的任务是检查是否可以通过去掉树上的一条边将树分成两棵,且这两棵树结点之和相等。</p>
10-
11-
<p><strong>样例 1:</strong></p>
12-
13-
<pre><strong>输入:</strong>
14-
5
15-
/ \
16-
10 10
17-
/ \
18-
2 3
19-
20-
<strong>输出:</strong> True
21-
<strong>解释:</strong>
22-
5
23-
/
24-
10
25-
26-
和: 15
27-
28-
10
29-
/ \
30-
2 3
31-
32-
和: 15
33-
</pre>
9+
<p>给你一棵二叉树的根节点 <code>root</code>,如果你可以通过去掉原始树上的一条边将树分成两棵节点值之和相等的子树,则返回 <code>true</code>。</p>
3410

3511
<p>&nbsp;</p>
3612

37-
<p><strong>样例 2:</strong></p>
38-
39-
<pre><strong>输入:</strong>
40-
1
41-
/ \
42-
2 10
43-
/ \
44-
2 20
13+
<p><strong class="example">示例 1:</strong></p>
14+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0600-0699/0663.Equal%20Tree%20Partition/images/split1-tree.jpg" style="width: 500px; height: 204px;" />
15+
<pre>
16+
<strong>输入:</strong>root = [5,10,10,null,null,2,3]
17+
<strong>输出:</strong>true
18+
</pre>
4519

46-
<strong>输出:</strong> False
47-
<strong>解释:</strong> 无法通过移除一条树边将这棵树划分成结点之和相等的两棵子树。
20+
<p><strong class="example">示例 2:</strong></p>
21+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0600-0699/0663.Equal%20Tree%20Partition/images/split2-tree.jpg" style="width: 277px; height: 302px;" />
22+
<pre>
23+
<strong>输入:</strong>root = [1,2,10,null,null,2,20]
24+
<strong>输出:</strong>false
25+
<strong>解释:</strong>在树上移除一条边无法将树分成两棵节点值之和相等的子树。
4826
</pre>
4927

5028
<p>&nbsp;</p>
5129

52-
<p><strong>注释 :</strong></p>
30+
<p><strong>提示:</strong></p>
5331

54-
<ol>
55-
<li>树上结点的权值范围 [-100000, 100000]。</li>
56-
<li>1 &lt;= n &lt;= 10000</li>
57-
</ol>
58-
59-
<p>&nbsp;</p>
32+
<ul>
33+
<li>树中节点数目在 <code>[1, 10<sup>4</sup>]</code> 范围内。</li>
34+
<li><code>-10<sup>5</sup> &lt;= Node.val &lt;= 10<sup>5</sup></code></li>
35+
</ul>
6036

6137
## 解法
6238

solution/0800-0899/0840.Magic Squares In Grid/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
<p><strong>示例 2:</strong></p>
3131

3232
<pre>
33-
<strong>输出:</strong> grid = [[8]]
34-
<strong>输入:</strong> 0
33+
<strong>输入:</strong> grid = [[8]]
34+
<strong>输出:</strong> 0
3535
</pre>
3636

3737
<p>&nbsp;</p>

solution/1200-1299/1206.Design Skiplist/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212

1313
<p>例如,一个跳表包含 <code>[30, 40, 50, 60, 70, 90]</code> ,然后增加 <code>80</code>、<code>45</code> 到跳表中,以下图的方式操作:</p>
1414

15-
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1200-1299/1206.Design%20Skiplist/images/1506_skiplist.gif" /><br />
16-
<small>Artyom Kalinin [CC BY-SA 3.0], via <a href="https://commons.wikimedia.org/wiki/File:Skip_list_add_element-en.gif" target="_blank" title="Artyom Kalinin [CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0)], via Wikimedia Commons">Wikimedia Commons</a></small></p>
15+
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1200-1299/1206.Design%20Skiplist/images/1702370216-mKQcTt-1506_skiplist.gif" style="width: 500px; height: 173px;" /></p>
1716

1817
<p>跳表中有很多层,每一层是一个短的链表。在第一层的作用下,增加、删除和搜索操作的时间复杂度不超过 <code>O(n)</code>。跳表的每一个操作的平均时间复杂度是 <code>O(log(n))</code>,空间复杂度是 <code>O(n)</code>。</p>
1918

20-
<p>了解更多 :&nbsp;<a href="https://en.wikipedia.org/wiki/Skip_list" target="_blank">https://en.wikipedia.org/wiki/Skip_list</a></p>
19+
<p>了解更多 :&nbsp;<a href="https://oi-wiki.org/ds/skiplist/" target="_blank">https://oi-wiki.org/ds/skiplist/</a></p>
2120

2221
<p>在本题中,你的设计应该要包含这些函数:</p>
2322

solution/1200-1299/1222.Queens That Can Attack the King/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Description
66

7-
<p>On a <strong>0-indexed</strong> <code>8 x 8</code> chessboard, there can be multiple black queens ad one white king.</p>
7+
<p>On a <strong>0-indexed</strong> <code>8 x 8</code> chessboard, there can be multiple black queens and one white king.</p>
88

99
<p>You are given a 2D integer array <code>queens</code> where <code>queens[i] = [xQueen<sub>i</sub>, yQueen<sub>i</sub>]</code> represents the position of the <code>i<sup>th</sup></code> black queen on the chessboard. You are also given an integer array <code>king</code> of length <code>2</code> where <code>king = [xKing, yKing]</code> represents the position of the white king.</p>
1010

solution/2500-2599/2533.Number of Good Binary Strings/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</li>
1818
<li>The size of each block of consecutive <code>0</code>&#39;s is a multiple of <code>zeroGroup</code>.
1919
<ul>
20-
<li>For example, in a binary string <code><u>00</u>11<u>0</u>1111<u>00</u></code> sizes of each block of consecutive ones are <code>[2,1,2]</code>.</li>
20+
<li>For example, in a binary string <code><u>00</u>11<u>0</u>1111<u>00</u></code> sizes of each block of consecutive zeros are <code>[2,1,2]</code>.</li>
2121
</ul>
2222
</li>
2323
</ul>

solution/2600-2699/2692.Make Object Immutable/README_EN.md

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ fn = (obj) =&gt; {
8383
<p><strong>Constraints:</strong></p>
8484

8585
<ul>
86+
<li><code>obj</code>&nbsp;is a valid JSON object or array</li>
8687
<li><code>2 &lt;= JSON.stringify(obj).length &lt;= 10<sup>5</sup></code></li>
8788
</ul>
8889

solution/2700-2799/2715.Timeout Cancellation/README_EN.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
<p>Given a function <code>fn</code>, an array of&nbsp;arguments&nbsp;<code>args</code>, and a timeout&nbsp;<code>t</code>&nbsp;in milliseconds, return a cancel function <code>cancelFn</code>.</p>
88

9-
<p>After a delay of <code>cancelT</code>, the returned cancel function <code>cancelFn</code> will be invoked.</p>
9+
<p>After a delay of <code>cancelTimeMs</code>, the returned cancel function <code>cancelFn</code> will be invoked.</p>
1010

1111
<pre>
12-
setTimeout(cancelFn, cancelT)
12+
setTimeout(cancelFn, cancelTimeMs)
1313
</pre>
1414

1515
<p>Initially, the execution of the function <code>fn</code> should be delayed by <code>t</code> milliseconds.</p>
@@ -23,7 +23,7 @@ setTimeout(cancelFn, cancelT)
2323
<strong>Input:</strong> fn = (x) =&gt; x * 5, args = [2], t = 20
2424
<strong>Output:</strong> [{&quot;time&quot;: 20, &quot;returned&quot;: 10}]
2525
<strong>Explanation:</strong>
26-
const cancelT = 50;
26+
const cancelTimeMs = 50;
2727
const result = [];
2828

2929
const fn = (x) =&gt; x * 5;
@@ -39,13 +39,13 @@ const cancel = cancellable(log, [2], 20);
3939

4040
const maxT = Math.max(t, 50);
4141
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
42-
setTimeout(cancel, cancelT);
42+
setTimeout(cancel, cancelTimeMs);
4343

4444
setTimeout(() =&gt; {
4545
&nbsp; &nbsp; console.log(result); // [{&quot;time&quot;:20,&quot;returned&quot;:10}]
46-
}, 65);
46+
}, maxT + 15);
4747

48-
The cancellation was scheduled to occur after a delay of cancelT (50ms), which happened after the execution of fn(2) at 20ms.
48+
The cancellation was scheduled to occur after a delay of cancelTimeMs (50ms), which happened after the execution of fn(2) at 20ms.
4949
</pre>
5050

5151
<p><strong class="example">Example 2:</strong></p>
@@ -54,8 +54,8 @@ The cancellation was scheduled to occur after a delay of cancelT (50ms), which h
5454
<strong>Input:</strong> fn = (x) =&gt; x**2, args = [2], t = 100
5555
<strong>Output:</strong> []
5656
<strong>Explanation:</strong>
57-
const cancelT = 50;
58-
The cancellation was scheduled to occur after a delay of cancelT (50ms), which happened before the execution of fn(2) at 100ms, resulting in fn(2) never being called.
57+
const cancelTimeMs = 50;
58+
The cancellation was scheduled to occur after a delay of cancelTimeMs (50ms), which happened before the execution of fn(2) at 100ms, resulting in fn(2) never being called.
5959
</pre>
6060

6161
<p><strong class="example">Example 3:</strong></p>
@@ -64,8 +64,8 @@ The cancellation was scheduled to occur after a delay of cancelT (50ms), which h
6464
<strong>Input:</strong> fn = (x1, x2) =&gt; x1 * x2, args = [2,4], t = 30
6565
<strong>Output:</strong> [{&quot;time&quot;: 30, &quot;returned&quot;: 8}]
6666
<strong>Explanation:
67-
</strong>const cancelT = 100;
68-
The cancellation was scheduled to occur after a delay of cancelT (100ms), which happened after the execution of fn(2,4) at 30ms.
67+
</strong>const cancelTimeMs = 100;
68+
The cancellation was scheduled to occur after a delay of cancelTimeMs (100ms), which happened after the execution of fn(2,4) at 30ms.
6969
</pre>
7070

7171
<p>&nbsp;</p>
@@ -76,7 +76,7 @@ The cancellation was scheduled to occur after a delay of cancelT (100ms), which
7676
<li><code>args</code> is a valid JSON array</li>
7777
<li><code>1 &lt;= args.length &lt;= 10</code></li>
7878
<li><code><font face="monospace">20 &lt;= t &lt;= 1000</font></code></li>
79-
<li><code><font face="monospace">10 &lt;= cancelT &lt;= 1000</font></code></li>
79+
<li><code><font face="monospace">10 &lt;= cancelTimeMs &lt;= 1000</font></code></li>
8080
</ul>
8181

8282
## Solutions

solution/2700-2799/2725.Interval Cancellation/README_EN.md

+22-16
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
<p>Given a function <code>fn</code>, an array of arguments&nbsp;<code>args</code>, and&nbsp;an interval time <code>t</code>, return a cancel function <code>cancelFn</code>.</p>
88

9-
<p>The function <code>fn</code> should be called with <code>args</code> immediately and then called again every&nbsp;<code>t</code> milliseconds&nbsp;until&nbsp;<code>cancelFn</code>&nbsp;is called at <code>cancelT</code> ms.</p>
9+
<p>The function <code>fn</code> should be called with <code>args</code> immediately and then called again every&nbsp;<code>t</code> milliseconds&nbsp;until&nbsp;<code>cancelFn</code>&nbsp;is called at <code>cancelTimeMs</code> ms.</p>
1010

1111
<p>&nbsp;</p>
1212
<p><strong class="example">Example 1:</strong></p>
1313

1414
<pre>
15-
<strong>Input:</strong> fn = (x) =&gt; x * 2, args = [4], t = 35, cancelT = 190
15+
<strong>Input:</strong> fn = (x) =&gt; x * 2, args = [4], t = 35
1616
<strong>Output:</strong>
1717
[
1818
{&quot;time&quot;: 0, &quot;returned&quot;: 8},
@@ -23,23 +23,23 @@
2323
{&quot;time&quot;: 175, &quot;returned&quot;: 8}
2424
]
2525
<strong>Explanation:</strong>
26-
const result = []
27-
const fn = (x) =&gt; x * 2
28-
const args = [4], t = 35, cancelT = 190
26+
const result = [];
27+
const fn = (x) =&gt; x * 2;
28+
const cancelTimeMs = 190;
2929

30-
const start = performance.now()
30+
const start = performance.now();
3131

3232
const log = (...argsArr) =&gt; {
33-
const diff = Math.floor(performance.now() - start)
34-
result.push({&quot;time&quot;: diff, &quot;returned&quot;: fn(...argsArr)})
33+
const diff = Math.floor(performance.now() - start);
34+
result.push({&quot;time&quot;: diff, &quot;returned&quot;: fn(...argsArr)});
3535
}
3636

3737
const cancel = cancellable(log, [4], 35);
38-
setTimeout(cancel, 190);
38+
setTimeout(cancel, cancelTimeMs);
3939

4040
setTimeout(() =&gt; {
41-
console.log(result) // Output
42-
}, cancelT + t + 15)
41+
console.log(result); // Output
42+
}, cancelTimeMs + 50)
4343

4444
Every 35ms, fn(4) is called. Until t=190ms, then it is cancelled.
4545
1st fn call is at 0ms. fn(4) returns 8.
@@ -54,7 +54,7 @@ Cancelled at 190ms
5454
<p><strong class="example">Example 2:</strong></p>
5555

5656
<pre>
57-
<strong>Input:</strong> fn = (x1, x2) =&gt; (x1 * x2), args = [2, 5], t = 30, cancelT = 165
57+
<strong>Input:</strong> fn = (x1, x2) =&gt; (x1 * x2), args = [2, 5], t = 30
5858
<strong>Output:</strong>
5959
[
6060
{&quot;time&quot;: 0, &quot;returned&quot;: 10},
@@ -64,7 +64,10 @@ Cancelled at 190ms
6464
{&quot;time&quot;: 120, &quot;returned&quot;: 10},
6565
{&quot;time&quot;: 150, &quot;returned&quot;: 10}
6666
]
67-
<strong>Explanation:</strong> Every 30ms, fn(2, 5) is called. Until t=165ms, then it is cancelled.
67+
<strong>Explanation:</strong>
68+
const cancelTimeMs = 165;
69+
70+
Every 30ms, fn(2, 5) is called. Until t=165ms, then it is cancelled.
6871
1st fn call is at 0ms&nbsp;
6972
2nd fn call is at 30ms&nbsp;
7073
3rd fn call is at 60ms&nbsp;
@@ -77,15 +80,18 @@ Cancelled at 165ms
7780
<p><strong class="example">Example 3:</strong></p>
7881

7982
<pre>
80-
<strong>Input:</strong> fn = (x1, x2, x3) =&gt; (x1 + x2 + x3), args = [5, 1, 3], t = 50, cancelT = 180
83+
<strong>Input:</strong> fn = (x1, x2, x3) =&gt; (x1 + x2 + x3), args = [5, 1, 3], t = 50
8184
<strong>Output:</strong>
8285
[
8386
{&quot;time&quot;: 0, &quot;returned&quot;: 9},
8487
{&quot;time&quot;: 50, &quot;returned&quot;: 9},
8588
{&quot;time&quot;: 100, &quot;returned&quot;: 9},
8689
{&quot;time&quot;: 150, &quot;returned&quot;: 9}
8790
]
88-
<strong>Explanation:</strong> Every 50ms, fn(5, 1, 3) is called. Until t=180ms, then it is cancelled.
91+
<strong>Explanation:</strong>
92+
const cancelTimeMs = 180;
93+
94+
Every 50ms, fn(5, 1, 3) is called. Until t=180ms, then it is cancelled.
8995
1st fn call is at 0ms
9096
2nd fn call is at 50ms
9197
3rd fn call is at 100ms
@@ -101,7 +107,7 @@ Cancelled at 180ms
101107
<li><code>args</code> is a valid JSON array</li>
102108
<li><code>1 &lt;= args.length &lt;= 10</code></li>
103109
<li><code><font face="monospace">30 &lt;= t &lt;= 100</font></code></li>
104-
<li><code><font face="monospace">10 &lt;= cancelT &lt;= 500</font></code></li>
110+
<li><code><font face="monospace">10 &lt;= </font>cancelTimeMs<font face="monospace"> &lt;= 500</font></code></li>
105111
</ul>
106112

107113
## Solutions

solution/2800-2899/2865.Beautiful Towers I/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
<ol>
1616
<li><code>1 &lt;= heights[i] &lt;= maxHeights[i]</code></li>
17-
<li><code>heights</code>&nbsp;是一个 <strong>山状</strong>&nbsp;数组。</li>
17+
<li><code>heights</code>&nbsp;是一个 <strong>山脉</strong> 数组。</li>
1818
</ol>
1919

20-
<p>如果存在下标 <code>i</code>&nbsp;满足以下条件,那么我们称数组&nbsp;<code>heights</code>&nbsp;是一个 <strong>山状</strong>&nbsp;数组:</p>
20+
<p>如果存在下标 <code>i</code>&nbsp;满足以下条件,那么我们称数组&nbsp;<code>heights</code>&nbsp;是一个 <strong>山脉</strong> 数组:</p>
2121

2222
<ul>
2323
<li>对于所有&nbsp;<code>0 &lt; j &lt;= i</code>&nbsp;,都有&nbsp;<code>heights[j - 1] &lt;= heights[j]</code></li>
@@ -35,7 +35,7 @@
3535
<b>输出:</b>13
3636
<b>解释:</b>和最大的美丽塔方案为 heights = [5,3,3,1,1] ,这是一个美丽塔方案,因为:
3737
- 1 &lt;= heights[i] &lt;= maxHeights[i]
38-
- heights 是个山状数组,峰值在 i = 0 处。
38+
- heights 是个山脉数组,峰值在 i = 0 处。
3939
13 是所有美丽塔方案中的最大高度和。</pre>
4040

4141
<p><strong class="example">示例 2:</strong></p>
@@ -45,7 +45,7 @@
4545
<b>输出:</b>22
4646
<strong>解释:</strong> 和最大的美丽塔方案为 heights = [3,3,3,9,2,2] ,这是一个美丽塔方案,因为:
4747
- 1 &lt;= heights[i] &lt;= maxHeights[i]
48-
- heights 是个山状数组,峰值在 i = 3 处。
48+
- heights 是个山脉数组,峰值在 i = 3 处。
4949
22 是所有美丽塔方案中的最大高度和。</pre>
5050

5151
<p><strong class="example">示例 3:</strong></p>
@@ -55,7 +55,7 @@
5555
<b>输出:</b>18
5656
<strong>解释:</strong>和最大的美丽塔方案为 heights = [2,2,5,5,2,2] ,这是一个美丽塔方案,因为:
5757
- 1 &lt;= heights[i] &lt;= maxHeights[i]
58-
- heights 是个山状数组,最大值在 i = 2 处。
58+
- heights 是个山脉数组,最大值在 i = 2 处。
5959
注意,在这个方案中,i = 3 也是一个峰值。
6060
18 是所有美丽塔方案中的最大高度和。
6161
</pre>

0 commit comments

Comments
 (0)