Skip to content

Commit 0b51c1f

Browse files
committed
update
1 parent 95eae77 commit 0b51c1f

File tree

43 files changed

+15126
-11230
lines changed

Some content is hidden

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

43 files changed

+15126
-11230
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 力扣题库(完整版)
22

3-
> 最后更新日期: **2022.09.17**
3+
> 最后更新日期: **2022.09.19**
44
>
55
> 使用脚本前请务必仔细完整阅读本 `README.md` 文件
66

Diff for: leetcode-cn/origin-data.json

+6,598-6,430
Large diffs are not rendered by default.

Diff for: leetcode-cn/originData/count-days-spent-together.json

+164
Large diffs are not rendered by default.

Diff for: leetcode-cn/originData/length-of-the-longest-alphabetical-continuous-substring.json

+164
Large diffs are not rendered by default.

Diff for: leetcode-cn/originData/maximum-matching-of-players-with-trainers.json

+164
Large diffs are not rendered by default.

Diff for: leetcode-cn/originData/minimum-money-required-before-transactions.json

+165
Large diffs are not rendered by default.

Diff for: leetcode-cn/originData/reverse-odd-levels-of-binary-tree.json

+164
Large diffs are not rendered by default.

Diff for: leetcode-cn/originData/smallest-even-multiple.json

+164
Large diffs are not rendered by default.

Diff for: leetcode-cn/originData/smallest-subarrays-with-maximum-bitwise-or.json

+166
Large diffs are not rendered by default.

Diff for: leetcode-cn/originData/sum-of-prefix-scores-of-strings.json

+164
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<p>给你一棵 <strong>完美</strong> 二叉树的根节点 <code>root</code> ,请你反转这棵树中每个 <strong>奇数</strong> 层的节点值。</p>
2+
3+
<ul>
4+
<li>例如,假设第 3 层的节点值是 <code>[2,1,3,4,7,11,29,18]</code> ,那么反转后它应该变成 <code>[18,29,11,7,4,3,1,2]</code></li>
5+
</ul>
6+
7+
<p>反转后,返回树的根节点。</p>
8+
9+
<p><strong>完美</strong> 二叉树需满足:二叉树的所有父节点都有两个子节点,且所有叶子节点都在同一层。</p>
10+
11+
<p>节点的 <strong>层数</strong> 等于该节点到根节点之间的边数。</p>
12+
13+
<p>&nbsp;</p>
14+
15+
<p><strong>示例 1:</strong></p>
16+
<img alt="" src="https://assets.leetcode.com/uploads/2022/07/28/first_case1.png" style="width: 626px; height: 191px;" />
17+
<pre>
18+
<strong>输入:</strong>root = [2,3,5,8,13,21,34]
19+
<strong>输出:</strong>[2,5,3,8,13,21,34]
20+
<strong>解释:</strong>
21+
这棵树只有一个奇数层。
22+
在第 1 层的节点分别是 3、5 ,反转后为 5、3 。
23+
</pre>
24+
25+
<p><strong>示例 2:</strong></p>
26+
<img alt="" src="https://assets.leetcode.com/uploads/2022/07/28/second_case3.png" style="width: 591px; height: 111px;" />
27+
<pre>
28+
<strong>输入:</strong>root = [7,13,11]
29+
<strong>输出:</strong>[7,11,13]
30+
<strong>解释:</strong>
31+
在第 1 层的节点分别是 13、11 ,反转后为 11、13 。
32+
</pre>
33+
34+
<p><strong>示例 3:</strong></p>
35+
36+
<pre>
37+
<strong>输入:</strong>root = [0,1,2,0,0,0,0,1,1,1,1,2,2,2,2]
38+
<strong>输出:</strong>[0,2,1,0,0,0,0,2,2,2,2,1,1,1,1]
39+
<strong>解释:</strong>奇数层由非零值组成。
40+
在第 1 层的节点分别是 1、2 ,反转后为 2、1 。
41+
在第 3 层的节点分别是 1、1、1、1、2、2、2、2 ,反转后为 2、2、2、2、1、1、1、1 。
42+
</pre>
43+
44+
<p>&nbsp;</p>
45+
46+
<p><strong>提示:</strong></p>
47+
48+
<ul>
49+
<li>树中的节点数目在范围 <code>[1, 2<sup>14</sup>]</code></li>
50+
<li><code>0 &lt;= Node.val &lt;= 10<sup>5</sup></code></li>
51+
<li><code>root</code> 是一棵 <strong>完美</strong> 二叉树</li>
52+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<p>给你一个长度为 <code>n</code> 的数组 <code>words</code> ,该数组由 <strong>非空</strong> 字符串组成。</p>
2+
3+
<p>定义字符串 <code>word</code><strong>分数</strong> 等于以 <code>word</code> 作为 <strong>前缀</strong><code>words[i]</code> 的数目。</p>
4+
5+
<ul>
6+
<li>例如,如果 <code>words = ["a", "ab", "abc", "cab"]</code> ,那么 <code>"ab"</code> 的分数是 <code>2</code> ,因为 <code>"ab"</code><code>"ab"</code><code>"abc"</code> 的一个前缀。</li>
7+
</ul>
8+
9+
<p>返回一个长度为<em> </em><code>n</code> 的数组<em> </em><code>answer</code><em> </em>,其中<em> </em><code>answer[i]</code><em> </em><em>&nbsp;</em><code>words[i]</code> 的每个非空前缀的分数 <strong>总和</strong> <em></em></p>
10+
11+
<p><strong>注意:</strong>字符串视作它自身的一个前缀。</p>
12+
13+
<p>&nbsp;</p>
14+
15+
<p><strong>示例 1:</strong></p>
16+
17+
<pre><strong>输入:</strong>words = ["abc","ab","bc","b"]
18+
<strong>输出:</strong>[5,4,3,2]
19+
<strong>解释:</strong>对应每个字符串的答案如下:
20+
- "abc" 有 3 个前缀:"a"、"ab" 和 "abc" 。
21+
- 2 个字符串的前缀为 "a" ,2 个字符串的前缀为 "ab" ,1 个字符串的前缀为 "abc" 。
22+
总计 answer[0] = 2 + 2 + 1 = 5 。
23+
- "ab" 有 2 个前缀:"a" 和 "ab" 。
24+
- 2 个字符串的前缀为 "a" ,2 个字符串的前缀为 "ab" 。
25+
总计 answer[1] = 2 + 2 = 4 。
26+
- "bc" 有 2 个前缀:"b" 和 "bc" 。
27+
- 2 个字符串的前缀为 "b" ,1 个字符串的前缀为 "bc" 。
28+
总计 answer[2] = 2 + 1 = 3 。
29+
- "b" 有 1 个前缀:"b"。
30+
- 2 个字符串的前缀为 "b" 。
31+
总计 answer[3] = 2 。
32+
</pre>
33+
34+
<p><strong>示例 2:</strong></p>
35+
36+
<pre><strong>输入:</strong>words = ["abcd"]
37+
<strong>输出:</strong>[4]
38+
<strong>解释:</strong>
39+
"abcd" 有 4 个前缀 "a"、"ab"、"abc" 和 "abcd"。
40+
每个前缀的分数都是 1 ,总计 answer[0] = 1 + 1 + 1 + 1 = 4 。
41+
</pre>
42+
43+
<p>&nbsp;</p>
44+
45+
<p><strong>提示:</strong></p>
46+
47+
<ul>
48+
<li><code>1 &lt;= words.length &lt;= 1000</code></li>
49+
<li><code>1 &lt;= words[i].length &lt;= 1000</code></li>
50+
<li><code>words[i]</code> 由小写英文字母组成</li>
51+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<p>给你一个下标从 <strong>0</strong>&nbsp;开始的二维整数数组&nbsp;<code><font face="monospace">transactions</font></code>,其中<code>transactions[i] = [cost<sub>i</sub>, cashback<sub>i</sub>]</code>&nbsp;。</p>
2+
3+
<p>数组描述了若干笔交易。其中每笔交易必须以 <strong>某种顺序</strong> 恰好完成一次。在任意一个时刻,你有一定数目的钱&nbsp;<code>money</code>&nbsp;,为了完成交易&nbsp;<code>i</code>&nbsp;,<code>money &gt;= cost<sub>i</sub></code>&nbsp;这个条件必须为真。执行交易后,你的钱数&nbsp;<code>money</code> 变成&nbsp;<code>money - cost<sub>i</sub> + cashback<sub>i</sub></code><sub>&nbsp;</sub></p>
4+
5+
<p>请你返回 <strong>任意一种</strong> 交易顺序下,你都能完成所有交易的最少钱数<em>&nbsp;</em><code>money</code>&nbsp;是多少。</p>
6+
7+
<p>&nbsp;</p>
8+
9+
<p><strong>示例 1:</strong></p>
10+
11+
<pre>
12+
<b>输入:</b>transactions = [[2,1],[5,0],[4,2]]
13+
<b>输出:</b>10
14+
<strong>解释:
15+
</strong>刚开始 money = 10 ,交易可以以任意顺序进行。
16+
可以证明如果 money &lt; 10 ,那么某些交易无法进行。
17+
</pre>
18+
19+
<p><strong>示例 2:</strong></p>
20+
21+
<pre>
22+
<strong>输入:</strong>transactions = [[3,0],[0,3]]
23+
<b>输出:</b>3
24+
<strong>解释:</strong>
25+
- 如果交易执行的顺序是 [[3,0],[0,3]] ,完成所有交易需要的最少钱数是 3 。
26+
- 如果交易执行的顺序是 [[0,3],[3,0]] ,完成所有交易需要的最少钱数是 0 。
27+
所以,刚开始钱数为 3 ,任意顺序下交易都可以全部完成。
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
32+
<p><strong>提示:</strong></p>
33+
34+
<ul>
35+
<li><code>1 &lt;= transactions.length &lt;= 10<sup>5</sup></code></li>
36+
<li><code>transactions[i].length == 2</code></li>
37+
<li><code>0 &lt;= cost<sub>i</sub>, cashback<sub>i</sub> &lt;= 10<sup>9</sup></code></li>
38+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<p>给你一个长度为 <code>n</code>&nbsp;下标从 <strong>0</strong>&nbsp;开始的数组&nbsp;<code>nums</code>&nbsp;,数组中所有数字均为非负整数。对于&nbsp;<code>0</code>&nbsp;到&nbsp;<code>n - 1</code>&nbsp;之间的每一个下标 <code>i</code>&nbsp;,你需要找出&nbsp;<code>nums</code>&nbsp;中一个 <strong>最小</strong> 非空子数组,它的起始位置为&nbsp;<code>i</code>&nbsp;(包含这个位置),同时有&nbsp;<strong>最大</strong>&nbsp;的 <strong>按位或</strong><b>运算值</b>&nbsp;。</p>
2+
3+
<ul>
4+
<li>换言之,令&nbsp;<code>B<sub>ij</sub></code>&nbsp;表示子数组&nbsp;<code>nums[i...j]</code>&nbsp;的按位或运算的结果,你需要找到一个起始位置为&nbsp;<code>i</code>&nbsp;的最小子数组,这个子数组的按位或运算的结果等于&nbsp;<code>max(B<sub>ik</sub>)</code>&nbsp;,其中&nbsp;<code>i &lt;= k &lt;= n - 1</code>&nbsp;。</li>
5+
</ul>
6+
7+
<p>一个数组的按位或运算值是这个数组里所有数字按位或运算的结果。</p>
8+
9+
<p>请你返回一个大小为 <code>n</code>&nbsp;的整数数组<em>&nbsp;</em><code>answer</code>,其中<em>&nbsp;</em><code>answer[i]</code>是开始位置为&nbsp;<code>i</code>&nbsp;,按位或运算结果最大,且&nbsp;<strong>最短</strong>&nbsp;子数组的长度。</p>
10+
11+
<p><strong>子数组</strong>&nbsp;是数组里一段连续非空元素组成的序列。</p>
12+
13+
<p>&nbsp;</p>
14+
15+
<p><strong>示例 1:</strong></p>
16+
17+
<pre><b>输入:</b>nums = [1,0,2,1,3]
18+
<b>输出:</b>[3,3,2,2,1]
19+
<strong>解释:</strong>
20+
任何位置开始,最大按位或运算的结果都是 3 。
21+
- 下标 0 处,能得到结果 3 的最短子数组是 [1,0,2] 。
22+
- 下标 1 处,能得到结果 3 的最短子数组是 [0,2,1] 。
23+
- 下标 2 处,能得到结果 3 的最短子数组是 [2,1] 。
24+
- 下标 3 处,能得到结果 3 的最短子数组是 [1,3] 。
25+
- 下标 4 处,能得到结果 3 的最短子数组是 [3] 。
26+
所以我们返回 [3,3,2,2,1] 。
27+
</pre>
28+
29+
<p><strong>示例 2:</strong></p>
30+
31+
<pre><b>输入:</b>nums = [1,2]
32+
<b>输出:</b>[2,1]
33+
<strong>解释:
34+
</strong>下标 0 处,能得到最大按位或运算值的最短子数组长度为 2 。
35+
下标 1 处,能得到最大按位或运算值的最短子数组长度为 1 。
36+
所以我们返回 [2,1] 。
37+
</pre>
38+
39+
<p>&nbsp;</p>
40+
41+
<p><strong>提示:</strong></p>
42+
43+
<ul>
44+
<li><code>n == nums.length</code></li>
45+
<li><code>1 &lt;= n &lt;= 10<sup>5</sup></code></li>
46+
<li><code>0 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
47+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
给你一个正整数 <code>n</code> ,返回 <code>2</code><em> </em><em> </em><code>n</code> 的最小公倍数(正整数)。
2+
<p>&nbsp;</p>
3+
4+
<p><strong>示例 1:</strong></p>
5+
6+
<pre><strong>输入:</strong>n = 5
7+
<strong>输出:</strong>10
8+
<strong>解释:</strong>5 和 2 的最小公倍数是 10 。
9+
</pre>
10+
11+
<p><strong>示例 2:</strong></p>
12+
13+
<pre><strong>输入:</strong>n = 6
14+
<strong>输出:</strong>6
15+
<strong>解释:</strong>6 和 2 的最小公倍数是 6 。注意数字会是它自身的倍数。
16+
</pre>
17+
18+
<p>&nbsp;</p>
19+
20+
<p><strong>提示:</strong></p>
21+
22+
<ul>
23+
<li><code>1 &lt;= n &lt;= 150</code></li>
24+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<p><strong>字母序连续字符串</strong> 是由字母表中连续字母组成的字符串。换句话说,字符串 <code>"abcdefghijklmnopqrstuvwxyz"</code> 的任意子字符串都是 <strong>字母序连续字符串</strong></p>
2+
3+
<ul>
4+
<li>例如,<code>"abc"</code> 是一个字母序连续字符串,而 <code>"acb"</code><code>"za"</code> 不是。</li>
5+
</ul>
6+
7+
<p>给你一个仅由小写英文字母组成的字符串 <code>s</code> ,返回其 <strong>最长</strong> 的 字母序连续子字符串 的长度。</p>
8+
9+
<p>&nbsp;</p>
10+
11+
<p><strong>示例 1:</strong></p>
12+
13+
<pre><strong>输入:</strong>s = "abacaba"
14+
<strong>输出:</strong>2
15+
<strong>解释:</strong>共有 4 个不同的字母序连续子字符串 "a"、"b"、"c" 和 "ab" 。
16+
"ab" 是最长的字母序连续子字符串。
17+
</pre>
18+
19+
<p><strong>示例 2:</strong></p>
20+
21+
<pre><strong>输入:</strong>s = "abcde"
22+
<strong>输出:</strong>5
23+
<strong>解释:</strong>"abcde" 是最长的字母序连续子字符串。
24+
</pre>
25+
26+
<p>&nbsp;</p>
27+
28+
<p><strong>提示:</strong></p>
29+
30+
<ul>
31+
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
32+
<li><code>s</code> 由小写英文字母组成</li>
33+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<p>Alice 和 Bob 计划分别去罗马开会。</p>
2+
3+
<p>给你四个字符串&nbsp;<code>arriveAlice</code>&nbsp;,<code>leaveAlice</code>&nbsp;,<code>arriveBob</code>&nbsp;和&nbsp;<code>leaveBob</code>&nbsp;。Alice 会在日期&nbsp;<code>arriveAlice</code>&nbsp;到&nbsp;<code>leaveAlice</code>&nbsp;之间在城市里(<strong>日期为闭区间</strong>),而 Bob 在日期&nbsp;<code>arriveBob</code>&nbsp;到&nbsp;<code>leaveBob</code>&nbsp;之间在城市里(<strong>日期为闭区间</strong>)。每个字符串都包含 5 个字符,格式为&nbsp;<code>"MM-DD"</code>&nbsp;,对应着一个日期的月和日。</p>
4+
5+
<p>请你返回 Alice和 Bob 同时在罗马的天数。</p>
6+
7+
<p>你可以假设所有日期都在 <strong>同一个</strong>&nbsp;自然年,而且 <strong>不是</strong>&nbsp;闰年。每个月份的天数分别为:<code>[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]</code>&nbsp;。</p>
8+
9+
<p>&nbsp;</p>
10+
11+
<p><strong>示例 1:</strong></p>
12+
13+
<pre>
14+
<b>输入:</b>arriveAlice = "08-15", leaveAlice = "08-18", arriveBob = "08-16", leaveBob = "08-19"
15+
<b>输出:</b>3
16+
<b>解释:</b>Alice 从 8 月 15 号到 8 月 18 号在罗马。Bob 从 8 月 16 号到 8 月 19 号在罗马,他们同时在罗马的日期为 8 月 16、17 和 18 号。所以答案为 3 。
17+
</pre>
18+
19+
<p><strong>示例 2:</strong></p>
20+
21+
<pre>
22+
<b>输入:</b>arriveAlice = "10-01", leaveAlice = "10-31", arriveBob = "11-01", leaveBob = "12-31"
23+
<b>输出:</b>0
24+
<b>解释:</b>Alice 和 Bob 没有同时在罗马的日子,所以我们返回 0 。
25+
</pre>
26+
27+
<p>&nbsp;</p>
28+
29+
<p><strong>提示:</strong></p>
30+
31+
<ul>
32+
<li>所有日期的格式均为&nbsp;<code>"MM-DD"</code>&nbsp;。</li>
33+
<li>Alice 和 Bob 的到达日期都 <strong>早于或等于</strong> 他们的离开日期。</li>
34+
<li>题目测试用例所给出的日期均为 <strong>非闰年</strong> 的有效日期。</li>
35+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<p>给你一个下标从 <strong>0</strong>&nbsp;开始的整数数组&nbsp;<code>players</code>&nbsp;,其中&nbsp;<code>players[i]</code>&nbsp;表示第 <code>i</code>&nbsp;名运动员的 <strong>能力</strong>&nbsp;值,同时给你一个下标从 <strong>0</strong>&nbsp;开始的整数数组&nbsp;<code>trainers</code>&nbsp;,其中&nbsp;<code>trainers[j]</code>&nbsp;表示第 <code>j</code>&nbsp;名训练师的 <strong>训练能力值</strong>&nbsp;。</p>
2+
3+
<p>如果第 <code>i</code>&nbsp;名运动员的能力值 <strong>小于等于</strong>&nbsp;第 <code>j</code>&nbsp;名训练师的能力值,那么第&nbsp;<code>i</code>&nbsp;名运动员可以 <strong>匹配</strong>&nbsp;第&nbsp;<code>j</code>&nbsp;名训练师。除此以外,每名运动员至多可以匹配一位训练师,每位训练师最多可以匹配一位运动员。</p>
4+
5+
<p>请你返回满足上述要求&nbsp;<code>players</code>&nbsp;和 <code>trainers</code>&nbsp;的 <strong>最大</strong> 匹配数。</p>
6+
7+
<p>&nbsp;</p>
8+
9+
<p><strong>示例 1:</strong></p>
10+
11+
<pre><strong>输入:</strong>players = [4,7,9], trainers = [8,2,5,8]
12+
<b>输出:</b>2
13+
<b>解释:</b>
14+
得到两个匹配的一种方案是:
15+
- players[0] 与 trainers[0] 匹配,因为 4 &lt;= 8 。
16+
- players[1] 与 trainers[3] 匹配,因为 7 &lt;= 8 。
17+
可以证明 2 是可以形成的最大匹配数。
18+
</pre>
19+
20+
<p><strong>示例 2:</strong></p>
21+
22+
<pre><b>输入:</b>players = [1,1,1], trainers = [10]
23+
<b>输出:</b>1
24+
<b>解释:</b>
25+
训练师可以匹配所有 3 个运动员
26+
每个运动员至多只能匹配一个训练师,所以最大答案是 1 。
27+
</pre>
28+
29+
<p>&nbsp;</p>
30+
31+
<p><strong>提示:</strong></p>
32+
33+
<ul>
34+
<li><code>1 &lt;= players.length, trainers.length &lt;= 10<sup>5</sup></code></li>
35+
<li><code>1 &lt;= players[i], trainers[j] &lt;= 10<sup>9</sup></code></li>
36+
</ul>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<p>Given the <code>root</code> of a <strong>perfect</strong> binary tree, reverse the node values at each <strong>odd</strong> level of the tree.</p>
2+
3+
<ul>
4+
<li>For example, suppose the node values at level 3 are <code>[2,1,3,4,7,11,29,18]</code>, then it should become <code>[18,29,11,7,4,3,1,2]</code>.</li>
5+
</ul>
6+
7+
<p>Return <em>the root of the reversed tree</em>.</p>
8+
9+
<p>A binary tree is <strong>perfect</strong> if all parent nodes have two children and all leaves are on the same level.</p>
10+
11+
<p>The <strong>level</strong> of a node is the number of edges along the path between it and the root node.</p>
12+
13+
<p>&nbsp;</p>
14+
<p><strong>Example 1:</strong></p>
15+
<img alt="" src="https://assets.leetcode.com/uploads/2022/07/28/first_case1.png" style="width: 626px; height: 191px;" />
16+
<pre>
17+
<strong>Input:</strong> root = [2,3,5,8,13,21,34]
18+
<strong>Output:</strong> [2,5,3,8,13,21,34]
19+
<strong>Explanation:</strong>
20+
The tree has only one odd level.
21+
The nodes at level 1 are 3, 5 respectively, which are reversed and become 5, 3.
22+
</pre>
23+
24+
<p><strong>Example 2:</strong></p>
25+
<img alt="" src="https://assets.leetcode.com/uploads/2022/07/28/second_case3.png" style="width: 591px; height: 111px;" />
26+
<pre>
27+
<strong>Input:</strong> root = [7,13,11]
28+
<strong>Output:</strong> [7,11,13]
29+
<strong>Explanation:</strong>
30+
The nodes at level 1 are 13, 11, which are reversed and become 11, 13.
31+
</pre>
32+
33+
<p><strong>Example 3:</strong></p>
34+
35+
<pre>
36+
<strong>Input:</strong> root = [0,1,2,0,0,0,0,1,1,1,1,2,2,2,2]
37+
<strong>Output:</strong> [0,2,1,0,0,0,0,2,2,2,2,1,1,1,1]
38+
<strong>Explanation:</strong>
39+
The odd levels have non-zero values.
40+
The nodes at level 1 were 1, 2, and are 2, 1 after the reversal.
41+
The nodes at level 3 were 1, 1, 1, 1, 2, 2, 2, 2, and are 2, 2, 2, 2, 1, 1, 1, 1 after the reversal.
42+
</pre>
43+
44+
<p>&nbsp;</p>
45+
<p><strong>Constraints:</strong></p>
46+
47+
<ul>
48+
<li>The number of nodes in the tree is in the range <code>[1, 2<sup>14</sup>]</code>.</li>
49+
<li><code>0 &lt;= Node.val &lt;= 10<sup>5</sup></code></li>
50+
<li><code>root</code> is a <strong>perfect</strong> binary tree.</li>
51+
</ul>

0 commit comments

Comments
 (0)