Skip to content

Commit 3901737

Browse files
committed
feat: add new lc problems
1 parent b8a55ab commit 3901737

File tree

28 files changed

+609
-156
lines changed

28 files changed

+609
-156
lines changed

solution/0000-0099/0029.Divide Two Integers/README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,37 @@
66

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

9-
<p>给定两个整数,被除数&nbsp;<code>dividend</code>&nbsp;和除数&nbsp;<code>divisor</code>。将两数相除,要求不使用乘法、除法和 mod 运算符。</p>
9+
<p>给你两个整数,被除数&nbsp;<code>dividend</code>&nbsp;和除数&nbsp;<code>divisor</code>。将两数相除,要求 <strong>不使用</strong> 乘法、除法和取余运算。</p>
1010

11-
<p>返回被除数&nbsp;<code>dividend</code>&nbsp;除以除数&nbsp;<code>divisor</code>&nbsp;得到的商。</p>
11+
<p>整数除法应该向零截断,也就是截去(<code>truncate</code>)其小数部分。例如,<code>8.345</code> 将被截断为 <code>8</code> ,<code>-2.7335</code> 将被截断至 <code>-2</code> 。</p>
1212

13-
<p>整数除法的结果应当截去(<code>truncate</code>)其小数部分,例如:<code>truncate(8.345) = 8</code> 以及 <code>truncate(-2.7335) = -2</code></p>
13+
<p>返回被除数&nbsp;<code>dividend</code>&nbsp;除以除数&nbsp;<code>divisor</code>&nbsp;得到的 <strong>商</strong> 。</p>
14+
15+
<p><strong>注意:</strong>假设我们的环境只能存储 <strong>32 位</strong> 有符号整数,其数值范围是 <code>[−2<sup>31</sup>,&nbsp; 2<sup>31&nbsp;</sup>− 1]</code> 。本题中,如果商 <strong>严格大于</strong> <code>2<sup>31&nbsp;</sup>− 1</code> ,则返回 <code>2<sup>31&nbsp;</sup>− 1</code> ;如果商 <strong>严格小于</strong> <code>-2<sup>31</sup></code> ,则返回 <code>-2<sup>31</sup></code><sup> </sup>。</p>
1416

1517
<p>&nbsp;</p>
1618

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

19-
<pre><strong>输入:</strong> dividend = 10, divisor = 3
21+
<pre>
22+
<strong>输入:</strong> dividend = 10, divisor = 3
2023
<strong>输出:</strong> 3
21-
<strong>解释: </strong>10/3 = truncate(3.33333..) = truncate(3) = 3</pre>
24+
<strong>解释: </strong>10/3 = 3.33333.. ,向零截断后得到 3 。</pre>
2225

2326
<p><strong>示例&nbsp;2:</strong></p>
2427

25-
<pre><strong>输入:</strong> dividend = 7, divisor = -3
28+
<pre>
29+
<strong>输入:</strong> dividend = 7, divisor = -3
2630
<strong>输出:</strong> -2
27-
<strong>解释:</strong> 7/-3 = truncate(-2.33333..) = -2</pre>
31+
<strong>解释:</strong> 7/-3 = -2.33333.. ,向零截断后得到 -2</pre>
2832

2933
<p>&nbsp;</p>
3034

3135
<p><strong>提示:</strong></p>
3236

3337
<ul>
34-
<li>被除数和除数均为 32 位有符号整数。</li>
35-
<li>除数不为&nbsp;0。</li>
36-
<li>假设我们的环境只能存储 32 位有符号整数,其数值范围是 [&minus;2<sup>31</sup>,&nbsp; 2<sup>31&nbsp;</sup>&minus; 1]。本题中,如果除法结果溢出,则返回 2<sup>31&nbsp;</sup>&minus; 1。</li>
38+
<li><code>-2<sup>31</sup> &lt;= dividend, divisor &lt;= 2<sup>31</sup> - 1</code></li>
39+
<li><code>divisor != 0</code></li>
3740
</ul>
3841

3942
## 解法

solution/0100-0199/0189.Rotate Array/README_EN.md

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

55
## Description
66

7-
<p>Given an array, rotate the array to the right by <code>k</code> steps, where <code>k</code> is non-negative.</p>
7+
<p>Given an integer array <code>nums</code>, rotate the array to the right by <code>k</code> steps, where <code>k</code> is non-negative.</p>
88

99
<p>&nbsp;</p>
1010
<p><strong class="example">Example 1:</strong></p>

solution/0300-0399/0301.Remove Invalid Parentheses/README_EN.md

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

77
<p>Given a string <code>s</code> that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.</p>
88

9-
<p>Return <em>all the possible results</em>. You may return the answer in <strong>any order</strong>.</p>
9+
<p>Return <em>a list of <strong>unique strings</strong> that are valid with the minimum number of removals</em>. You may return the answer in <strong>any order</strong>.</p>
1010

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

solution/0300-0399/0336.Palindrome Pairs/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<p>A <strong>palindrome pair</strong> is a pair of integers <code>(i, j)</code> such that:</p>
1010

1111
<ul>
12-
<li><code>0 &lt;= i, j &lt; word.length</code>,</li>
12+
<li><code>0 &lt;= i, j &lt; words.length</code>,</li>
1313
<li><code>i != j</code>, and</li>
1414
<li><code>words[i] + words[j]</code> (the concatenation of the two strings) is a <span data-keyword="palindrome-string">palindrome</span>.</li>
1515
</ul>

solution/0700-0799/0753.Cracking the Safe/README.md

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,59 @@
66

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

9-
<p>有一个需要密码才能打开的保险箱。密码是&nbsp;<code>n</code> 位数, 密码的每一位是&nbsp;<code>k</code>&nbsp;位序列&nbsp;<code>0, 1, ..., k-1</code>&nbsp;中的一个 。</p>
9+
<p>有一个需要密码才能打开的保险箱。密码是&nbsp;<code>n</code> 位数, 密码的每一位都是范围&nbsp;<code>[0, k - 1]</code>&nbsp;中的一个数字。</p>
1010

11-
<p>你可以随意输入密码,保险箱会自动记住最后&nbsp;<code>n</code>&nbsp;位输入,如果匹配,则能够打开保险箱。</p>
11+
<p>保险箱有一种特殊的密码校验方法,你可以随意输入密码序列,保险箱会自动记住 <strong>最后&nbsp;<code>n</code>&nbsp;位输入</strong> ,如果匹配,则能够打开保险箱。</p>
1212

13-
<p>举个例子,假设密码是&nbsp;<code>&quot;345&quot;</code>,你可以输入&nbsp;<code>&quot;012345&quot;</code>&nbsp;来打开它,只是你输入了 6&nbsp;个字符.</p>
13+
<ul>
14+
<li>例如,正确的密码是 <code>"345"</code> ,并且你输入的是 <code>"012345"</code> :
1415

15-
<p>请返回一个能打开保险箱的最短字符串。</p>
16+
<ul>
17+
<li>输入 <code>0</code> 之后,最后 <code>3</code> 位输入是 <code>"0"</code> ,不正确。</li>
18+
<li>输入 <code>1</code> 之后,最后 <code>3</code> 位输入是 <code>"01"</code> ,不正确。</li>
19+
<li>输入 <code>2</code> 之后,最后 <code>3</code> 位输入是 <code>"012"</code> ,不正确。</li>
20+
<li>输入 <code>3</code> 之后,最后 <code>3</code> 位输入是 <code>"123"</code> ,不正确。</li>
21+
<li>输入 <code>4</code> 之后,最后 <code>3</code> 位输入是 <code>"234"</code> ,不正确。</li>
22+
<li>输入 <code>5</code> 之后,最后 <code>3</code> 位输入是 <code>"345"</code> ,正确,打开保险箱。</li>
23+
</ul>
24+
</li>
1625

17-
<p>&nbsp;</p>
18-
19-
<p><strong>示例1:</strong></p>
26+
</ul>
2027

21-
<pre><strong>输入:</strong> n = 1, k = 2
22-
<strong>输出:</strong> &quot;01&quot;
23-
<strong>说明:</strong> &quot;10&quot;也可以打开保险箱。
24-
</pre>
28+
<p>在只知道密码位数 <code>n</code> 和范围边界 <code>k</code> 的前提下,请你找出并返回确保在输入的 <strong>某个时刻</strong> 能够打开保险箱的任一 <strong>最短</strong> 密码序列 。</p>
2529

2630
<p>&nbsp;</p>
2731

28-
<p><strong>示例2:</strong></p>
32+
<p><strong>示例 1:</strong></p>
2933

30-
<pre><strong>输入:</strong> n = 2, k = 2
31-
<strong>输出:</strong> &quot;00110&quot;
32-
<strong>说明: </strong>&quot;01100&quot;, &quot;10011&quot;, &quot;11001&quot; 也能打开保险箱。
34+
<pre>
35+
<strong>输入:</strong>n = 1, k = 2
36+
<strong>输出:</strong>"10"
37+
<strong>解释:</strong>密码只有 1 位,所以输入每一位就可以。"01" 也能够确保打开保险箱。
38+
</pre>
39+
40+
<p><strong>示例 2:</strong></p>
41+
42+
<pre>
43+
<strong>输入:</strong>n = 2, k = 2
44+
<strong>输出:</strong>"01100"
45+
<strong>解释:</strong>对于每种可能的密码:
46+
- "00" 从第 4 位开始输入。
47+
- "01" 从第 1 位开始输入。
48+
- "10" 从第 3 位开始输入。
49+
- "11" 从第 2 位开始输入。
50+
因此 "01100" 可以确保打开保险箱。"01100"、"10011" 和 "11001" 也可以确保打开保险箱。
3351
</pre>
3452

3553
<p>&nbsp;</p>
3654

3755
<p><strong>提示:</strong></p>
3856

39-
<ol>
40-
<li><code>n</code> 的范围是&nbsp;<code>[1, 4]</code>。</li>
41-
<li><code>k</code> 的范围是&nbsp;<code>[1, 10]</code>。</li>
42-
<li><code>k^n</code> 最大可能为&nbsp;<code>4096</code>。</li>
43-
</ol>
44-
45-
<p>&nbsp;</p>
57+
<ul>
58+
<li><code>1 &lt;= n &lt;= 4</code></li>
59+
<li><code>1 &lt;= k &lt;= 10</code></li>
60+
<li><code>1 &lt;= k<sup>n</sup> &lt;= 4096</code></li>
61+
</ul>
4662

4763
## 解法
4864

solution/0700-0799/0757.Set Intersection Size At Least Two/README.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,54 @@
66

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

9-
<p>一个整数区间&nbsp;<code>[a, b]</code>&nbsp;&nbsp;(&nbsp;<code>a &lt; b</code>&nbsp;) 代表着从&nbsp;<code>a</code>&nbsp;&nbsp;<code>b</code>&nbsp;的所有连续整数,包括&nbsp;<code>a</code>&nbsp;&nbsp;<code>b</code>。</p>
9+
<p>给你一个二维整数数组 <code>intervals</code> ,其中 <code>intervals[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> 表示从 <code>start<sub>i</sub></code><code>end<sub>i</sub></code> 的所有整数,包括 <code>start<sub>i</sub></code><code>end<sub>i</sub></code> 。</p>
1010

11-
<p>给你一组整数区间<code>intervals</code>,请找到一个最小的集合 S,使得 S 里的元素与区间<code>intervals</code>中的每一个整数区间都至少有2个元素相交。</p>
11+
<p><strong>包含集合</strong> 是一个名为 <code>nums</code> 的数组,并满足 <code>intervals</code> 中的每个区间都 <strong>至少</strong> 有 <strong>两个</strong> 整数在 <code>nums</code> 中。</p>
1212

13-
<p>输出这个最小集合S的大小。</p>
13+
<ul>
14+
<li>例如,如果 <code>intervals = [[1,3], [3,7], [8,9]]</code> ,那么 <code>[1,2,4,7,8,9]</code> 和 <code>[2,3,4,8,9]</code> 都符合 <strong>包含集合</strong> 的定义。</li>
15+
</ul>
1416

15-
<p><strong>示例 1:</strong></p>
17+
<p>返回包含集合可能的最小大小。</p>
1618

17-
<pre><strong>输入:</strong> intervals = [[1, 3], [1, 4], [2, 5], [3, 5]]
18-
<strong>输出:</strong> 3
19-
<strong>解释:</strong>
20-
考虑集合 S = {2, 3, 4}. S与intervals中的四个区间都有至少2个相交的元素。
21-
且这是S最小的情况,故我们输出3。
19+
<p>&nbsp;</p>
20+
21+
<p><strong class="example">示例 1:</strong></p>
22+
23+
<pre>
24+
<strong>输入:</strong>intervals = [[1,3],[3,7],[8,9]]
25+
<strong>输出:</strong>5
26+
<strong>解释:</strong>nums = [2, 3, 4, 8, 9].
27+
可以证明不存在元素数量为 4 的包含集合。
28+
</pre>
29+
30+
<p><strong class="example">示例 2:</strong></p>
31+
32+
<pre>
33+
<strong>输入:</strong>intervals = [[1,3],[1,4],[2,5],[3,5]]
34+
<strong>输出:</strong>3
35+
<strong>解释:</strong>nums = [2, 3, 4].
36+
可以证明不存在元素数量为 2 的包含集合。
2237
</pre>
2338

24-
<p><strong>示例 2:</strong></p>
39+
<p><strong class="example">示例 3:</strong></p>
2540

26-
<pre><strong>输入:</strong> intervals = [[1, 2], [2, 3], [2, 4], [4, 5]]
27-
<strong>输出:</strong> 5
28-
<strong>解释:</strong>
29-
最小的集合S = {1, 2, 3, 4, 5}.
41+
<pre>
42+
<strong>输入:</strong>intervals = [[1,2],[2,3],[2,4],[4,5]]
43+
<strong>输出:</strong>5
44+
<strong>解释:</strong>nums = [1, 2, 3, 4, 5].
45+
可以证明不存在元素数量为 4 的包含集合。
3046
</pre>
3147

32-
<p><strong>注意:</strong></p>
48+
<p>&nbsp;</p>
49+
50+
<p><strong>提示:</strong></p>
3351

34-
<ol>
35-
<li><code>intervals</code>&nbsp;的长度范围为<code>[1, 3000]</code></li>
36-
<li><code>intervals[i]</code>&nbsp;长度为&nbsp;<code>2</code>,分别代表左、右边界。</li>
37-
<li><code>intervals[i][j]</code> 的值是&nbsp;<code>[0, 10^8]</code>范围内的整数。</li>
38-
</ol>
52+
<ul>
53+
<li><code>1 &lt;= intervals.length &lt;= 3000</code></li>
54+
<li><code>intervals[i].length == 2</code></li>
55+
<li><code>0 &lt;= start<sub>i</sub> &lt; end<sub>i</sub> &lt;= 10<sup>8</sup></code></li>
56+
</ul>
3957

4058
## 解法
4159

solution/0900-0999/0944.Delete Columns to Make Sorted/README_EN.md

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

77
<p>You are given an array of <code>n</code> strings <code>strs</code>, all of the same length.</p>
88

9-
<p>The strings can be arranged such that there is one on each line, making a grid. For example, <code>strs = [&quot;abc&quot;, &quot;bce&quot;, &quot;cae&quot;]</code> can be arranged as:</p>
9+
<p>The strings can be arranged such that there is one on each line, making a grid.</p>
10+
11+
<ul>
12+
<li>For example, <code>strs = [&quot;abc&quot;, &quot;bce&quot;, &quot;cae&quot;]</code> can be arranged as follows:</li>
13+
</ul>
1014

1115
<pre>
1216
abc
1317
bce
1418
cae
1519
</pre>
1620

17-
<p>You want to <strong>delete</strong> the columns that are <strong>not sorted lexicographically</strong>. In the above example (0-indexed), columns 0 (<code>&#39;a&#39;</code>, <code>&#39;b&#39;</code>, <code>&#39;c&#39;</code>) and 2 (<code>&#39;c&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;e&#39;</code>) are sorted while column 1 (<code>&#39;b&#39;</code>, <code>&#39;c&#39;</code>, <code>&#39;a&#39;</code>) is not, so you would delete column 1.</p>
21+
<p>You want to <strong>delete</strong> the columns that are <strong>not sorted lexicographically</strong>. In the above example (<strong>0-indexed</strong>), columns 0 (<code>&#39;a&#39;</code>, <code>&#39;b&#39;</code>, <code>&#39;c&#39;</code>) and 2 (<code>&#39;c&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;e&#39;</code>) are sorted, while column 1 (<code>&#39;b&#39;</code>, <code>&#39;c&#39;</code>, <code>&#39;a&#39;</code>) is not, so you would delete column 1.</p>
1822

1923
<p>Return <em>the number of columns that you will delete</em>.</p>
2024

solution/1100-1199/1106.Parsing A Boolean Expression/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

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

9-
<p>有效的表达式需遵循以下约定:</p>
9+
<p><strong>布尔表达式</strong> 是计算结果不是 <code>true</code> 就是 <code>false</code> 的表达式。有效的表达式需遵循以下约定:</p>
1010

1111
<ul>
1212
<li><code>'t'</code>,运算结果为 <code>true</code></li>
@@ -16,7 +16,9 @@
1616
<li><code>'|(subExpr<sub>1</sub>, subExpr<sub>2</sub>, ..., subExpr<sub>n</sub>)'</code>,运算过程为对 2 个或以上内部表达式 <code>subExpr<sub>1</sub>, subExpr<sub>2</sub>, ..., subExpr<sub>n</sub></code> 进行 <strong>逻辑或</strong>(OR)运算</li>
1717
</ul>
1818

19-
<p>给你一个以字符串形式表述的&nbsp;<a href="https://baike.baidu.com/item/%E5%B8%83%E5%B0%94%E8%A1%A8%E8%BE%BE%E5%BC%8F/1574380?fr=aladdin" target="_blank">布尔表达式</a>(boolean) <code>expression</code>,返回该式的运算结果。</p>
19+
<p>给你一个以字符串形式表述的&nbsp;<a href="https://baike.baidu.com/item/%E5%B8%83%E5%B0%94%E8%A1%A8%E8%BE%BE%E5%BC%8F/1574380?fr=aladdin" target="_blank">布尔表达式</a> <code>expression</code>,返回该式的运算结果。</p>
20+
21+
<p>题目测试用例所给出的表达式均为有效的布尔表达式,遵循上述约定。</p>
2022

2123
<p>&nbsp;</p>
2224

solution/1100-1199/1145.Binary Tree Coloring Game/README.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,48 @@
88

99
<p>有两位极客玩家参与了一场「二叉树着色」的游戏。游戏中,给出二叉树的根节点&nbsp;<code>root</code>,树上总共有 <code>n</code> 个节点,且 <code>n</code> 为奇数,其中每个节点上的值从&nbsp;<code>1</code> 到&nbsp;<code>n</code>&nbsp;各不相同。</p>
1010

11-
<p>&nbsp;</p>
12-
13-
<p>游戏从「一号」玩家开始(「一号」玩家为红色,「二号」玩家为蓝色),最开始时,</p>
14-
15-
<p>「一号」玩家从 <code>[1, n]</code>&nbsp;中取一个值&nbsp;<code>x</code>(<code>1 &lt;= x &lt;= n</code>);</p>
11+
<p>最开始时:</p>
1612

17-
<p>「二号」玩家也从&nbsp;<code>[1, n]</code>&nbsp;中取一个值&nbsp;<code>y</code>(<code>1 &lt;= y &lt;= n</code>)且&nbsp;<code>y != x</code>。</p>
13+
<ul>
14+
<li>「一号」玩家从 <code>[1, n]</code>&nbsp;中取一个值&nbsp;<code>x</code>(<code>1 &lt;= x &lt;= n</code>);</li>
15+
<li>「二号」玩家也从&nbsp;<code>[1, n]</code>&nbsp;中取一个值&nbsp;<code>y</code>(<code>1 &lt;= y &lt;= n</code>)且&nbsp;<code>y != x</code>。</li>
16+
</ul>
1817

1918
<p>「一号」玩家给值为&nbsp;<code>x</code>&nbsp;的节点染上红色,而「二号」玩家给值为&nbsp;<code>y</code>&nbsp;的节点染上蓝色。</p>
2019

21-
<p>&nbsp;</p>
20+
<p>之后两位玩家轮流进行操作,「一号」玩家先手。每一回合,玩家选择一个之前涂好颜色的节点,将所选节点一个 <strong>未着色 </strong>的邻节点(即左右子节点、或父节点)进行染色(「一号」玩家染红色,「二号」玩家染蓝色)。</p>
2221

23-
<p>之后两位玩家轮流进行操作,每一回合,玩家选择一个他之前涂好颜色的节点,将所选节点一个 <strong>未着色 </strong>的邻节点(即左右子节点、或父节点)进行染色。</p>
24-
25-
<p>如果当前玩家无法找到这样的节点来染色时,他的回合就会被跳过。</p>
22+
<p>如果(且仅在此种情况下)当前玩家无法找到这样的节点来染色时,其回合就会被跳过。</p>
2623

2724
<p>若两个玩家都没有可以染色的节点时,游戏结束。着色节点最多的那位玩家获得胜利 ✌️。</p>
2825

29-
<p>&nbsp;</p>
30-
31-
<p>现在,假设你是「二号」玩家,根据所给出的输入,假如存在一个&nbsp;<code>y</code>&nbsp;值可以确保你赢得这场游戏,则返回&nbsp;<code>true</code>;若无法获胜,就请返回 <code>false</code>。</p>
32-
33-
<p>&nbsp;</p>
26+
<p>现在,假设你是「二号」玩家,根据所给出的输入,假如存在一个&nbsp;<code>y</code>&nbsp;值可以确保你赢得这场游戏,则返回&nbsp;<code>true</code> ;若无法获胜,就请返回 <code>false</code> 。</p>
27+
&nbsp;
3428

35-
<p><strong>示例:</strong></p>
29+
<p><strong class="example">示例 1 :</strong></p>
30+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1100-1199/1145.Binary%20Tree%20Coloring%20Game/images/1480-binary-tree-coloring-game.png" style="width: 500px; height: 310px;" />
31+
<pre>
32+
<strong>输入:</strong>root = [1,2,3,4,5,6,7,8,9,10,11], n = 11, x = 3
33+
<strong>输出:</strong>true
34+
<strong>解释:</strong>第二个玩家可以选择值为 2 的节点。</pre>
3635

37-
<p><strong><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1100-1199/1145.Binary%20Tree%20Coloring%20Game/images/1480-binary-tree-coloring-game.png" style="height: 186px; width: 300px;"></strong></p>
36+
<p><strong class="example">示例 2 :</strong></p>
3837

39-
<pre><strong>输入:</strong>root = [1,2,3,4,5,6,7,8,9,10,11], n = 11, x = 3
40-
<strong>输出:</strong>True
41-
<strong>解释:</strong>第二个玩家可以选择值为 2 的节点。
38+
<pre>
39+
<strong>输入:</strong>root = [1,2,3], n = 3, x = 1
40+
<strong>输出:</strong>false
4241
</pre>
4342

4443
<p>&nbsp;</p>
4544

4645
<p><strong>提示:</strong></p>
4746

4847
<ul>
49-
<li>二叉树的根节点为&nbsp;<code>root</code>,树上由 <code>n</code> 个节点,节点上的值从 <code>1</code> 到 <code>n</code> 各不相同。</li>
50-
<li><code>n</code> 为奇数。</li>
51-
<li><code>1 &lt;= x &lt;= n&nbsp;&lt;= 100</code></li>
48+
<li>树中节点数目为 <code>n</code></li>
49+
<li><code>1 &lt;= x &lt;= n &lt;= 100</code></li>
50+
<li><code>n</code> 是奇数</li>
51+
<li><code>1 &lt;= Node.val &lt;= n</code></li>
52+
<li>树中所有值 <strong>互不相同</strong></li>
5253
</ul>
5354

5455
## 解法

0 commit comments

Comments
 (0)