Skip to content

Commit 3a876ec

Browse files
authored
feat: update lc problems (doocs#3454)
1 parent 7cf45ae commit 3a876ec

File tree

62 files changed

+955
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+955
-258
lines changed

solution/0000-0099/0020.Valid Parentheses/README.md

+26-15
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,37 @@ tags:
2929

3030
<p>&nbsp;</p>
3131

32-
<p><strong>示例 1:</strong></p>
32+
<p><strong class="example">示例 1:</strong></p>
3333

34-
<pre>
35-
<strong>输入:</strong>s = "()"
36-
<strong>输出:</strong>true
37-
</pre>
34+
<div class="example-block">
35+
<p><span class="example-io"><b>输入:</b>s = "()"</span></p>
3836

39-
<p><strong>示例&nbsp;2:</strong></p>
37+
<p><span class="example-io"><b>输出:</b>true</span></p>
38+
</div>
4039

41-
<pre>
42-
<strong>输入:</strong>s = "()[]{}"
43-
<strong>输出:</strong>true
44-
</pre>
40+
<p><strong class="example">示例 2:</strong></p>
4541

46-
<p><strong>示例&nbsp;3:</strong></p>
42+
<div class="example-block">
43+
<p><span class="example-io"><b>输入:</b>s = "()[]{}"</span></p>
4744

48-
<pre>
49-
<strong>输入:</strong>s = "(]"
50-
<strong>输出:</strong>false
51-
</pre>
45+
<p><span class="example-io"><b>输出:</b>true</span></p>
46+
</div>
47+
48+
<p><strong class="example">示例 3:</strong></p>
49+
50+
<div class="example-block">
51+
<p><span class="example-io"><b>输入:</b>s = "(]"</span></p>
52+
53+
<p><span class="example-io"><b>输出:</b>false</span></p>
54+
</div>
55+
56+
<p><strong class="example">示例 4:</strong></p>
57+
58+
<div class="example-block">
59+
<p><span class="example-io"><b>输入:</b>s = "([])"</span></p>
60+
61+
<p><span class="example-io"><b>输出:</b>true</span></p>
62+
</div>
5263

5364
<p>&nbsp;</p>
5465

solution/0100-0199/0176.Second Highest Salary/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ tags:
2727
| id | int |
2828
| salary | int |
2929
+-------------+------+
30-
在 SQL 中,id 是这个表的主键。
30+
id 是这个表的主键。
3131
表的每一行包含员工的工资信息。
3232
</pre>
3333

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

36-
<p>查询并返回 <code>Employee</code>&nbsp;表中第二高的薪水 。如果不存在第二高的薪水,查询应该返回 <code>null(Pandas 则返回 None)</code> 。</p>
36+
<p>查询并返回 <code>Employee</code>&nbsp;表中第二高的 <b>不同</b>&nbsp;薪水 。如果不存在第二高的薪水,查询应该返回 <code>null(Pandas 则返回 None)</code> 。</p>
3737

3838
<p>查询结果如下例所示。</p>
3939

solution/0100-0199/0176.Second Highest Salary/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Each row of this table contains information about the salary of an employee.
3131

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

34-
<p>Write a solution to find&nbsp;the second highest salary from the <code>Employee</code> table. If there is no second highest salary,&nbsp;return&nbsp;<code>null (return&nbsp;None in Pandas)</code>.</p>
34+
<p>Write a solution to find&nbsp;the second highest <strong>distinct</strong> salary from the <code>Employee</code> table. If there is no second highest salary,&nbsp;return&nbsp;<code>null (return&nbsp;None in Pandas)</code>.</p>
3535

3636
<p>The result format is in the following example.</p>
3737

solution/0100-0199/0197.Rising Temperature/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This table contains information about the temperature on a certain day.
3333

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

36-
<p>Write a solution to find all dates&#39; <code>Id</code> with higher temperatures compared to its previous dates (yesterday).</p>
36+
<p>Write a solution to find all dates&#39; <code>id</code> with higher temperatures compared to its previous dates (yesterday).</p>
3737

3838
<p>Return the result table in <strong>any order</strong>.</p>
3939

solution/0200-0299/0205.Isomorphic Strings/README_EN.md

+36-9
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,42 @@ tags:
2525

2626
<p>&nbsp;</p>
2727
<p><strong class="example">Example 1:</strong></p>
28-
<pre><strong>Input:</strong> s = "egg", t = "add"
29-
<strong>Output:</strong> true
30-
</pre><p><strong class="example">Example 2:</strong></p>
31-
<pre><strong>Input:</strong> s = "foo", t = "bar"
32-
<strong>Output:</strong> false
33-
</pre><p><strong class="example">Example 3:</strong></p>
34-
<pre><strong>Input:</strong> s = "paper", t = "title"
35-
<strong>Output:</strong> true
36-
</pre>
28+
29+
<div class="example-block">
30+
<p><strong>Input:</strong> <span class="example-io">s = &quot;egg&quot;, t = &quot;add&quot;</span></p>
31+
32+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
33+
34+
<p><strong>Explanation:</strong></p>
35+
36+
<p>The strings <code>s</code> and <code>t</code> can be made identical by:</p>
37+
38+
<ul>
39+
<li>Mapping <code>&#39;e&#39;</code> to <code>&#39;a&#39;</code>.</li>
40+
<li>Mapping <code>&#39;g&#39;</code> to <code>&#39;d&#39;</code>.</li>
41+
</ul>
42+
</div>
43+
44+
<p><strong class="example">Example 2:</strong></p>
45+
46+
<div class="example-block">
47+
<p><strong>Input:</strong> <span class="example-io">s = &quot;foo&quot;, t = &quot;bar&quot;</span></p>
48+
49+
<p><strong>Output:</strong> <span class="example-io">false</span></p>
50+
51+
<p><strong>Explanation:</strong></p>
52+
53+
<p>The strings <code>s</code> and <code>t</code> can not be made identical as <code>&#39;o&#39;</code> needs to be mapped to both <code>&#39;a&#39;</code> and <code>&#39;r&#39;</code>.</p>
54+
</div>
55+
56+
<p><strong class="example">Example 3:</strong></p>
57+
58+
<div class="example-block">
59+
<p><strong>Input:</strong> <span class="example-io">s = &quot;paper&quot;, t = &quot;title&quot;</span></p>
60+
61+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
62+
</div>
63+
3764
<p>&nbsp;</p>
3865
<p><strong>Constraints:</strong></p>
3966

solution/0200-0299/0242.Valid Anagram/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ tags:
2020

2121
<p>给定两个字符串 <code><em>s</em></code> 和 <code><em>t</em></code> ,编写一个函数来判断 <code><em>t</em></code> 是否是 <code><em>s</em></code> 的字母异位词。</p>
2222

23-
<p><strong>注意:</strong>若 <code><em>s</em></code> 和 <code><em>t</em></code><em> </em>中每个字符出现的次数都相同,则称 <code><em>s</em></code> 和 <code><em>t</em></code><em> </em>互为字母异位词。</p>
23+
<p><strong>字母异位词</strong> 是通过重新排列不同单词或短语的字母而形成的单词或短语,通常只使用所有原始字母一次。</p>
2424

25-
<p> </p>
25+
<p>&nbsp;</p>
2626

27-
<p><strong>示例 1:</strong></p>
27+
<p><strong>示例&nbsp;1:</strong></p>
2828

2929
<pre>
3030
<strong>输入:</strong> <em>s</em> = "anagram", <em>t</em> = "nagaram"
@@ -37,18 +37,18 @@ tags:
3737
<strong>输入:</strong> <em>s</em> = "rat", <em>t</em> = "car"
3838
<strong>输出: </strong>false</pre>
3939

40-
<p> </p>
40+
<p>&nbsp;</p>
4141

4242
<p><strong>提示:</strong></p>
4343

4444
<ul>
45-
<li><code>1 <= s.length, t.length <= 5 * 10<sup>4</sup></code></li>
46-
<li><code>s</code> 和 <code>t</code> 仅包含小写字母</li>
45+
<li><code>1 &lt;= s.length, t.length &lt;= 5 * 10<sup>4</sup></code></li>
46+
<li><code>s</code> 和 <code>t</code>&nbsp;仅包含小写字母</li>
4747
</ul>
4848

49-
<p> </p>
49+
<p>&nbsp;</p>
5050

51-
<p><strong>进阶: </strong>如果输入字符串包含 unicode 字符怎么办?你能否调整你的解法来应对这种情况?</p>
51+
<p><strong>进阶:&nbsp;</strong>如果输入字符串包含 unicode 字符怎么办?你能否调整你的解法来应对这种情况?</p>
5252

5353
<!-- description:end -->
5454

solution/0400-0499/0455.Assign Cookies/README.md

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

2222
<p>假设你是一位很棒的家长,想要给你的孩子们一些小饼干。但是,每个孩子最多只能给一块饼干。</p>
2323

24-
<p>对每个孩子 <code>i</code>,都有一个胃口值&nbsp;<code>g[i]</code><sub>,</sub>这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 <code>j</code>,都有一个尺寸 <code>s[j]</code><sub>&nbsp;</sub>。如果 <code>s[j]&nbsp;&gt;= g[i]</code>,我们可以将这个饼干 <code>j</code> 分配给孩子 <code>i</code> ,这个孩子会得到满足。你的目标是尽可能满足越多数量的孩子,并输出这个最大数值。</p>
24+
<p>对每个孩子 <code>i</code>,都有一个胃口值&nbsp;<code>g[i]</code><sub>,</sub>这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 <code>j</code>,都有一个尺寸 <code>s[j]</code><sub>&nbsp;</sub>。如果 <code>s[j]&nbsp;&gt;= g[i]</code>,我们可以将这个饼干 <code>j</code> 分配给孩子 <code>i</code> ,这个孩子会得到满足。你的目标是满足尽可能多的孩子,并输出这个最大数值。</p>
2525
&nbsp;
2626

2727
<p><strong>示例&nbsp;1:</strong></p>

solution/0500-0599/0592.Fraction Addition and Subtraction/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tags:
2020

2121
<p>给定一个表示分数加减运算的字符串&nbsp;<code>expression</code>&nbsp;,你需要返回一个字符串形式的计算结果。&nbsp;</p>
2222

23-
<p>这个结果应该是不可约分的分数,即<a href="https://baike.baidu.com/item/%E6%9C%80%E7%AE%80%E5%88%86%E6%95%B0" target="_blank">最简分数</a>。&nbsp;如果最终结果是一个整数,例如&nbsp;<code>2</code>,你需要将它转换成分数形式,其分母为&nbsp;<code>1</code>。所以在上述例子中, <code>2</code>&nbsp;应该被转换为&nbsp;<code>2/1</code>。</p>
23+
<p>这个结果应该是不可约分的分数,即&nbsp;<a href="https://baike.baidu.com/item/%E6%9C%80%E7%AE%80%E5%88%86%E6%95%B0" target="_blank">最简分数</a>。&nbsp;如果最终结果是一个整数,例如&nbsp;<code>2</code>,你需要将它转换成分数形式,其分母为&nbsp;<code>1</code>。所以在上述例子中, <code>2</code>&nbsp;应该被转换为&nbsp;<code>2/1</code>。</p>
2424

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

@@ -52,9 +52,9 @@ tags:
5252
<ul>
5353
<li>输入和输出字符串只包含&nbsp;<code>'0'</code> 到&nbsp;<code>'9'</code>&nbsp;的数字,以及&nbsp;<code>'/'</code>, <code>'+'</code> 和&nbsp;<code>'-'</code>。&nbsp;</li>
5454
<li>输入和输出分数格式均为&nbsp;<code>±分子/分母</code>。如果输入的第一个分数或者输出的分数是正数,则&nbsp;<code>'+'</code>&nbsp;会被省略掉。</li>
55-
<li>输入只包含合法的<strong>最简分数</strong>,每个分数的<strong>分子</strong>与<strong>分母</strong>的范围是&nbsp;&nbsp;[1,10]。&nbsp;如果分母是1,意味着这个分数实际上是一个整数。</li>
55+
<li>输入只包含合法的&nbsp;<strong>最简分数</strong>,每个分数的<strong>分子</strong>与<strong>分母</strong>的范围是&nbsp;<code>[1,10]</code>。&nbsp;如果分母是 1,意味着这个分数实际上是一个整数。</li>
5656
<li>输入的分数个数范围是 [1,10]。</li>
57-
<li><strong>最终结果</strong>的分子与分母保证是 32 位整数范围内的有效整数。</li>
57+
<li><strong>最终结果&nbsp;</strong>的分子与分母保证是 32 位整数范围内的有效整数。</li>
5858
</ul>
5959

6060
<!-- description:end -->

solution/0600-0699/0626.Exchange Seats/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tags:
2727
+-------------+---------+
2828
<code>id</code> 是该表的主键(唯一值)列。
2929
该表的每一行都表示学生的姓名和 ID。
30-
id 是一个连续的增量
30+
ID 序列始终从 1 开始并连续增加
3131
</pre>
3232

3333
<p>&nbsp;</p>

solution/0600-0699/0673.Number of Longest Increasing Subsequence/README_EN.md

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ tags:
4646
<ul>
4747
<li><code>1 &lt;= nums.length &lt;= 2000</code></li>
4848
<li><code>-10<sup>6</sup> &lt;= nums[i] &lt;= 10<sup>6</sup></code></li>
49+
<li>The answer is guaranteed to fit inside a 32-bit integer.</li>
4950
</ul>
5051

5152
<!-- description:end -->

solution/0700-0799/0728.Self Dividing Numbers/README.md

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

2525
<p><strong>自除数</strong> 不允许包含 0 。</p>
2626

27-
<p>给定两个整数&nbsp;<code>left</code>&nbsp;&nbsp;<code>right</code> ,返回一个列表,<em>列表的元素是范围&nbsp;<code>[left, right]</code>&nbsp;内所有的 <strong>自除数</strong></em> 。</p>
27+
<p>给定两个整数&nbsp;<code>left</code>&nbsp;&nbsp;<code>right</code> ,返回一个列表,<em>列表的元素是范围&nbsp;<code>[left, right]</code>(包括两个端点)内所有的 <strong>自除数</strong></em> 。</p>
2828

2929
<p>&nbsp;</p>
3030

solution/0700-0799/0728.Self Dividing Numbers/README_EN.md

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

2525
<p>A <strong>self-dividing number</strong> is not allowed to contain the digit zero.</p>
2626

27-
<p>Given two integers <code>left</code> and <code>right</code>, return <em>a list of all the <strong>self-dividing numbers</strong> in the range</em> <code>[left, right]</code>.</p>
27+
<p>Given two integers <code>left</code> and <code>right</code>, return <em>a list of all the <strong>self-dividing numbers</strong> in the range</em> <code>[left, right]</code> (both <strong>inclusive</strong>).</p>
2828

2929
<p>&nbsp;</p>
3030
<p><strong class="example">Example 1:</strong></p>

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

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

2222
<p><code>3 x 3</code> 的幻方是一个填充有&nbsp;<strong>从 <code>1</code> 到 <code>9</code>&nbsp;</strong> 的不同数字的 <code>3 x 3</code> 矩阵,其中每行,每列以及两条对角线上的各数之和都相等。</p>
2323

24-
<p>给定一个由整数组成的<code>row x col</code>&nbsp;的 <code>grid</code>,其中有多少个&nbsp;<code>3 × 3</code> 的 “幻方” 子矩阵?(每个子矩阵都是连续的)。</p>
24+
<p>给定一个由整数组成的<code>row x col</code>&nbsp;的 <code>grid</code>,其中有多少个&nbsp;<code>3 × 3</code> 的 “幻方” 子矩阵?</p>
2525

2626
<p>注意:虽然幻方只能包含 1 到 9 的数字,但&nbsp;<code>grid</code> 可以包含最多15的数字。</p>
2727

solution/0900-0999/0909.Snakes and Ladders/README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ tags:
1818

1919
<!-- description:start -->
2020

21-
<p>给你一个大小为 <code>n x n</code> 的整数矩阵 <code>board</code> ,方格按从&nbsp;<code>1</code> 到 <code>n<sup>2</sup></code> 编号,编号遵循 <a href="https://baike.baidu.com/item/%E7%89%9B%E8%80%95%E5%BC%8F%E8%BD%AC%E8%A1%8C%E4%B9%A6%E5%86%99%E6%B3%95/17195786">转行交替方式</a><strong> </strong>,<strong>从左下角开始</strong>&nbsp;(即,从 <code>board[n - 1][0]</code> 开始)每一行交替方向。</p>
21+
<p>给你一个大小为 <code>n x n</code> 的整数矩阵 <code>board</code> ,方格按从&nbsp;<code>1</code> 到 <code>n<sup>2</sup></code> 编号,编号遵循 <a href="https://baike.baidu.com/item/%E7%89%9B%E8%80%95%E5%BC%8F%E8%BD%AC%E8%A1%8C%E4%B9%A6%E5%86%99%E6%B3%95/17195786">转行交替方式</a><strong> </strong>,<strong>从左下角开始</strong>&nbsp;(即,从 <code>board[n - 1][0]</code> 开始)的每一行改变方向。</p>
2222

23-
<p>玩家从棋盘上的方格&nbsp;<code>1</code> (总是在最后一行、第一列)开始出发。</p>
24-
25-
<p>每一回合,玩家需要从当前方格 <code>curr</code> 开始出发,按下述要求前进:</p>
23+
<p>你一开始位于棋盘上的方格&nbsp; <code>1</code>。每一回合,玩家需要从当前方格 <code>curr</code> 开始出发,按下述要求前进:</p>
2624

2725
<ul>
28-
<li>选定目标方格 <code>next</code> ,目标方格的编号符合范围&nbsp;<code>[curr + 1, min(curr + 6, n<sup>2</sup>)]</code> 。
26+
<li>选定目标方格 <code>next</code> ,目标方格的编号在范围&nbsp;<code>[curr + 1, min(curr + 6, n<sup>2</sup>)]</code> 。
2927

3028
<ul>
3129
<li>该选择模拟了掷 <strong>六面体骰子</strong> 的情景,无论棋盘大小如何,玩家最多只能有 6 个目的地。</li>
@@ -36,12 +34,12 @@ tags:
3634

3735
</ul>
3836

39-
<p><code>r</code> 行 <code>c</code> 列的棋盘,按前述方法编号,棋盘格中可能存在 “蛇” 或 “梯子”;如果 <code>board[r][c] != -1</code>,那个蛇或梯子的目的地将会是 <code>board[r][c]</code>。编号为 <code>1</code> 和 <code>n<sup>2</sup></code> 的方格不是任何蛇或梯子的起点。</p>
37+
<p>如果 <code>board[r][c] != -1</code>&nbsp;,位于&nbsp;<code>r</code> 行 <code>c</code> 列的棋盘格中可能存在 “蛇” 或 “梯子”那个蛇或梯子的目的地将会是 <code>board[r][c]</code>。编号为 <code>1</code> 和 <code>n<sup>2</sup></code> 的方格不是任何蛇或梯子的起点。</p>
4038

4139
<p>注意,玩家在每回合的前进过程中最多只能爬过蛇或梯子一次:就算目的地是另一条蛇或梯子的起点,玩家也 <strong>不能</strong> 继续移动。</p>
4240

4341
<ul>
44-
<li>举个例子,假设棋盘是 <code>[[-1,4],[-1,3]]</code> ,第一次移动,玩家的目标方格是 <code>2</code> 。那么这个玩家将会顺着梯子到达方格 <code>3</code> ,但 <strong>不能</strong> 顺着方格 <code>3</code> 上的梯子前往方格 <code>4</code> 。</li>
42+
<li>举个例子,假设棋盘是 <code>[[-1,4],[-1,3]]</code> ,第一次移动,玩家的目标方格是 <code>2</code> 。那么这个玩家将会顺着梯子到达方格 <code>3</code> ,但 <strong>不能</strong> 顺着方格 <code>3</code> 上的梯子前往方格 <code>4</code> 。(简单来说,类似飞行棋,玩家掷出骰子点数后移动对应格数,遇到单向的路径(即梯子或蛇)可以直接跳到路径的终点,但如果多个路径首尾相连,也不能连续跳多个路径)</li>
4543
</ul>
4644

4745
<p>返回达到编号为&nbsp;<code>n<sup>2</sup></code> 的方格所需的最少移动次数,如果不可能,则返回 <code>-1</code>。</p>

solution/1000-1099/1040.Moving Stones Until Consecutive II/README.md

+23-22
Original file line numberDiff line numberDiff line change
@@ -21,56 +21,57 @@ tags:
2121

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

24-
<p>在一个长度 <strong>无限 </strong>的数轴上,第 <code>i</code> 颗石子的位置为 <code>stones[i]</code>。如果一颗石子的位置最小/最大,那么该石子被称作 <strong>端点石子 </strong>。</p>
24+
<p>在 X 轴上有一些不同位置的石子。给定一个整数数组&nbsp;<code>stones</code>&nbsp;表示石子的位置。</p>
2525

26-
<p>每个回合,你可以将一颗端点石子拿起并移动到一个未占用的位置,使得该石子不再是一颗端点石子。</p>
26+
<p>如果一个石子在最小或最大的位置,称其为&nbsp;<strong>端点石子</strong>。每个回合,你可以将一颗 <strong>端点石子</strong> 拿起并移动到一个未占用的位置,使得该石子不再是一颗 <strong>端点石子</strong>。</p>
2727

28-
<p>值得注意的是,如果石子像 <code>stones = [1,2,5]</code> 这样,你将 <strong>无法 </strong>移动位于位置 5 的端点石子,因为无论将它移动到任何位置(例如 0 或 3),该石子都仍然会是端点石子。</p>
28+
<ul>
29+
<li>值得注意的是,如果石子像&nbsp;<code>stones = [1,2,5]</code>&nbsp;这样,你将 <strong>无法 </strong>移动位于位置 <code>5</code> 的端点石子,因为无论将它移动到任何位置(例如 <code>0</code> 或 <code>3</code>),该石子都仍然会是端点石子。</li>
30+
</ul>
2931

3032
<p>当你无法进行任何移动时,即,这些石子的位置连续时,游戏结束。</p>
3133

32-
<p>要使游戏结束,你可以执行的最小和最大移动次数分别是多少? 以长度为 2 的数组形式返回答案:<code>answer = [minimum_moves, maximum_moves]</code> 。</p>
34+
<p>以长度为 2 的数组形式返回答案,其中:</p>
35+
36+
<ul>
37+
<li><code>answer[0]</code>&nbsp;是你可以移动的最小次数</li>
38+
<li><code>answer[1]</code>&nbsp;是你可以移动的最大次数。</li>
39+
</ul>
3340

34-
<p> </p>
41+
<p>&nbsp;</p>
3542

3643
<p><strong>示例 1:</strong></p>
3744

3845
<pre>
3946
<strong>输入:</strong>[7,4,9]
4047
<strong>输出:</strong>[1,2]
4148
<strong>解释:</strong>
42-
我们可以移动一次,4 -> 8,游戏结束。
43-
或者,我们可以移动两次 9 -> 5,4 -> 6,游戏结束。
49+
我们可以移动一次,4 -&gt; 8,游戏结束。
50+
或者,我们可以移动两次 9 -&gt; 5,4 -&gt; 6,游戏结束。
4451
</pre>
4552

46-
<p><strong>示例 2:</strong></p>
53+
<p><strong>示例&nbsp;2:</strong></p>
4754

4855
<pre>
4956
<strong>输入:</strong>[6,5,4,3,10]
5057
<strong>输出:</strong>[2,3]
5158
<strong>解释:</strong>
52-
我们可以移动 3 -> 8,接着是 10 -> 7,游戏结束。
53-
或者,我们可以移动 3 -> 7, 4 -> 8, 5 -> 9,游戏结束。
54-
注意,我们无法进行 10 -> 2 这样的移动来结束游戏,因为这是不合要求的移动。
59+
我们可以移动 3 -&gt; 8,接着是 10 -&gt; 7,游戏结束。
60+
或者,我们可以移动 3 -&gt; 7, 4 -&gt; 8, 5 -&gt; 9,游戏结束。
61+
注意,我们无法进行 10 -&gt; 2 这样的移动来结束游戏,因为这是不合要求的移动。
5562
</pre>
5663

57-
<p><strong>示例 3:</strong></p>
58-
59-
<pre>
60-
<strong>输入:</strong>[100,101,104,102,103]
61-
<strong>输出:</strong>[0,0]</pre>
62-
63-
<p> </p>
64+
<p>&nbsp;</p>
6465

6566
<p><strong>提示:</strong></p>
6667

6768
<ul>
68-
<li><code>3 <= stones.length <= 10^4</code></li>
69-
<li><code>1 <= stones[i] <= 10^9</code></li>
70-
<li><code>stones[i]</code> 的值各不相同。</li>
69+
<li><code>3 &lt;= stones.length &lt;= 10<sup>4</sup></code></li>
70+
<li><code>1 &lt;= stones[i] &lt;= 10<sup>9</sup></code></li>
71+
<li><code>stones</code>&nbsp;的值各不相同。</li>
7172
</ul>
7273

73-
<p> </p>
74+
<p>&nbsp;</p>
7475

7576
<!-- description:end -->
7677

0 commit comments

Comments
 (0)