Skip to content

Commit cdc9249

Browse files
committed
add 2044
1 parent 015906a commit cdc9249

File tree

180 files changed

+6288
-2904
lines changed

Some content is hidden

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

180 files changed

+6288
-2904
lines changed

assets/output/0056.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ that cover all the intervals in the input_.
102102
| 616 | [给字符串添加加粗标签](https://leetcode.com/problems/add-bold-tag-in-string) | | [`字典树`](/leetcode/outline/tag/trie.md) [`数组`](/leetcode/outline/tag/array.md) [`哈希表`](/leetcode/outline/tag/hash-table.md) `2+` | <font color=#ffb800>Medium</font> |
103103
| 715 | [Range 模块](https://leetcode.com/problems/range-module) | | [`设计`](/leetcode/outline/tag/design.md) [`线段树`](/leetcode/outline/tag/segment-tree.md) [`有序集合`](/leetcode/outline/tag/ordered-set.md) | <font color=#ff334b>Hard</font> |
104104
| 759 | [员工空闲时间](https://leetcode.com/problems/employee-free-time) | | [`数组`](/leetcode/outline/tag/array.md) [`排序`](/leetcode/outline/tag/sorting.md) [`堆(优先队列)`](/leetcode/outline/tag/heap-priority-queue.md) | <font color=#ff334b>Hard</font> |
105-
| 763 | [划分字母区间](https://leetcode.com/problems/partition-labels) | | [`贪心`](/leetcode/outline/tag/greedy.md) [`哈希表`](/leetcode/outline/tag/hash-table.md) [`双指针`](/leetcode/outline/tag/two-pointers.md) `1+` | <font color=#ffb800>Medium</font> |
105+
| 763 | [划分字母区间](https://leetcode.com/problems/partition-labels) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0763) | [`贪心`](/leetcode/outline/tag/greedy.md) [`哈希表`](/leetcode/outline/tag/hash-table.md) [`双指针`](/leetcode/outline/tag/two-pointers.md) `1+` | <font color=#ffb800>Medium</font> |
106106
| 986 | [区间列表的交集](https://leetcode.com/problems/interval-list-intersections) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0986) | [`数组`](/leetcode/outline/tag/array.md) [`双指针`](/leetcode/outline/tag/two-pointers.md) | <font color=#ffb800>Medium</font> |
107107
| 2158 | [每天绘制新区域的数量](https://leetcode.com/problems/amount-of-new-area-painted-each-day) | | [`线段树`](/leetcode/outline/tag/segment-tree.md) [`数组`](/leetcode/outline/tag/array.md) [`有序集合`](/leetcode/outline/tag/ordered-set.md) | <font color=#ff334b>Hard</font> |
108108
| 2213 | [由单个字符重复的最长子字符串](https://leetcode.com/problems/longest-substring-of-one-repeating-character) | | [`线段树`](/leetcode/outline/tag/segment-tree.md) [`数组`](/leetcode/outline/tag/array.md) [`字符串`](/leetcode/outline/tag/string.md) `1+` | <font color=#ff334b>Hard</font> |

assets/output/0078.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ in **any order**.
9696
| 320 | [列举单词的全部缩写](https://leetcode.com/problems/generalized-abbreviation) | | [`位运算`](/leetcode/outline/tag/bit-manipulation.md) [`字符串`](/leetcode/outline/tag/string.md) [`回溯`](/leetcode/outline/tag/backtracking.md) | <font color=#ffb800>Medium</font> |
9797
| 784 | [字母大小写全排列](https://leetcode.com/problems/letter-case-permutation) | | [`位运算`](/leetcode/outline/tag/bit-manipulation.md) [`字符串`](/leetcode/outline/tag/string.md) [`回溯`](/leetcode/outline/tag/backtracking.md) | <font color=#ffb800>Medium</font> |
9898
| 1982 | [从子集的和还原数组](https://leetcode.com/problems/find-array-given-subset-sums) | | [`数组`](/leetcode/outline/tag/array.md) [`分治`](/leetcode/outline/tag/divide-and-conquer.md) | <font color=#ff334b>Hard</font> |
99-
| 2044 | [统计按位或能得到最大值的子集数目](https://leetcode.com/problems/count-number-of-maximum-bitwise-or-subsets) | | [`位运算`](/leetcode/outline/tag/bit-manipulation.md) [`数组`](/leetcode/outline/tag/array.md) [`回溯`](/leetcode/outline/tag/backtracking.md) `1+` | <font color=#ffb800>Medium</font> |
99+
| 2044 | [统计按位或能得到最大值的子集数目](https://leetcode.com/problems/count-number-of-maximum-bitwise-or-subsets) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/2044) | [`位运算`](/leetcode/outline/tag/bit-manipulation.md) [`数组`](/leetcode/outline/tag/array.md) [`回溯`](/leetcode/outline/tag/backtracking.md) `1+` | <font color=#ffb800>Medium</font> |
100100

101101
<style>
102102
.blue {

assets/output/0085.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ largest rectangle containing only `1`'s and return _its area_.
116116
<!-- prettier-ignore -->
117117
| 题号 | 标题 | 题解 | 标签 | 难度 |
118118
| :------: | :------ | :------: | :------ | :------ |
119-
| 84 | [柱状图中最大的矩形](https://leetcode.com/problems/largest-rectangle-in-histogram) | | [``](/leetcode/outline/tag/stack.md) [`数组`](/leetcode/outline/tag/array.md) [`单调栈`](/leetcode/outline/tag/monotonic-stack.md) | <font color=#ff334b>Hard</font> |
119+
| 84 | [柱状图中最大的矩形](https://leetcode.com/problems/largest-rectangle-in-histogram) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0084) | [``](/leetcode/outline/tag/stack.md) [`数组`](/leetcode/outline/tag/array.md) [`单调栈`](/leetcode/outline/tag/monotonic-stack.md) | <font color=#ff334b>Hard</font> |
120120
| 221 | [最大正方形](https://leetcode.com/problems/maximal-square) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0221) | [`数组`](/leetcode/outline/tag/array.md) [`动态规划`](/leetcode/outline/tag/dynamic-programming.md) [`矩阵`](/leetcode/outline/tag/matrix.md) | <font color=#ffb800>Medium</font> |
121121

122122
<style>

assets/output/0098.md

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,65 +9,87 @@ tree (BST)_.
99

1010
A **valid BST** is defined as follows:
1111

12-
- The left subtree of a node contains only nodes with keys **less than** the node's key.
13-
- The right subtree of a node contains only nodes with keys **greater than** the node's key.
14-
- Both the left and right subtrees must also be binary search trees.
12+
* The left subtree of a node contains only nodes with keys **less than** the node's key.
13+
* The right subtree of a node contains only nodes with keys **greater than** the node's key.
14+
* Both the left and right subtrees must also be binary search trees.
15+
16+
1517

1618
**Example 1:**
1719

1820
![](https://assets.leetcode.com/uploads/2020/12/01/tree1.jpg)
1921

2022
> Input: root = [2,1,3]
21-
>
23+
>
2224
> Output: true
2325
2426
**Example 2:**
2527

2628
![](https://assets.leetcode.com/uploads/2020/12/01/tree2.jpg)
2729

2830
> Input: root = [5,1,4,null,null,3,6]
29-
>
31+
>
3032
> Output: false
31-
>
33+
>
3234
> Explanation: The root node's value is 5 but its right child's value is 4.
3335
3436
**Constraints:**
3537

36-
- The number of nodes in the tree is in the range `[1, 10^4]`.
37-
- `-231 <= Node.val <= 231 - 1`
38+
* The number of nodes in the tree is in the range `[1, 104]`.
39+
* `-231 <= Node.val <= 231 - 1`
40+
3841

3942
## 题目大意
4043

4144
给你一个二叉树的根节点 `root` ,判断其是否是一个有效的二叉搜索树。
4245

4346
**有效** 二叉搜索树定义如下:
4447

45-
- 节点的左子树只包含**小于** 当前节点的数。
46-
- 节点的右子树只包含 **大于** 当前节点的数。
47-
- 所有左子树和右子树自身必须也是二叉搜索树。
48+
* 节点的左子树只包含**小于** 当前节点的数。
49+
* 节点的右子树只包含 **大于** 当前节点的数。
50+
* 所有左子树和右子树自身必须也是二叉搜索树。
51+
52+
4853

4954
**示例 1:**
5055

5156
![](https://assets.leetcode.com/uploads/2020/12/01/tree1.jpg)
5257

58+
>
59+
>
60+
>
61+
>
62+
>
5363
> **输入:** root = [2,1,3]
54-
>
64+
>
5565
> **输出:** true
66+
>
67+
>
5668
5769
**示例 2:**
5870

5971
![](https://assets.leetcode.com/uploads/2020/12/01/tree2.jpg)
6072

73+
>
74+
>
75+
>
76+
>
77+
>
6178
> **输入:** root = [5,1,4,null,null,3,6]
62-
>
79+
>
6380
> **输出:** false
64-
>
81+
>
6582
> **解释:** 根节点的值是 5 ,但是右子节点的值是 4 。
83+
>
84+
>
85+
86+
6687

6788
**提示:**
6889

69-
- 树中节点数目范围在`[1, 10^4]`
70-
- `-231 <= Node.val <= 231 - 1`
90+
* 树中节点数目范围在`[1, 104]`
91+
* `-231 <= Node.val <= 231 - 1`
92+
7193

7294
## 解题思路
7395

assets/output/0104.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,76 @@
66

77
Given the `root` of a binary tree, return _its maximum depth_.
88

9-
A binary tree's **maximum depth** is the number of nodes along the longest
9+
A binary tree's **maximum depth** is the number of nodes along the longest
1010
path from the root node down to the farthest leaf node.
1111

12+
13+
1214
**Example 1:**
1315

1416
![](https://assets.leetcode.com/uploads/2020/11/26/tmp-tree.jpg)
1517

1618
> Input: root = [3,9,20,null,null,15,7]
17-
>
19+
>
1820
> Output: 3
1921
2022
**Example 2:**
2123

2224
> Input: root = [1,null,2]
23-
>
25+
>
2426
> Output: 2
2527
2628
**Constraints:**
2729

28-
- The number of nodes in the tree is in the range `[0, 10^4]`.
29-
- `-100 <= Node.val <= 100`
30+
* The number of nodes in the tree is in the range `[0, 104]`.
31+
* `-100 <= Node.val <= 100`
32+
3033

3134
## 题目大意
3235

3336
给定一个二叉树 `root` ,返回其最大深度。
3437

3538
二叉树的 **最大深度** 是指从根节点到最远叶子节点的最长路径上的节点数。
3639

40+
41+
3742
**示例 1:**
3843

3944
![](https://assets.leetcode.com/uploads/2020/11/26/tmp-tree.jpg)
4045

46+
47+
48+
>
49+
>
50+
>
51+
>
52+
>
4153
> **输入:** root = [3,9,20,null,null,15,7]
42-
>
54+
>
4355
> **输出:** 3
56+
>
57+
>
4458
4559
**示例 2:**
4660

61+
>
62+
>
63+
>
64+
>
65+
>
4766
> **输入:** root = [1,null,2]
48-
>
67+
>
4968
> **输出:** 2
69+
>
70+
>
71+
72+
5073

5174
**提示:**
5275

53-
- 树中节点的数量在 `[0, 10^4]` 区间内。
54-
- `-100 <= Node.val <= 100`
76+
* 树中节点的数量在 `[0, 104]` 区间内。
77+
* `-100 <= Node.val <= 100`
78+
5579

5680
## 解题思路
5781

assets/output/0109.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,51 +8,73 @@ Given the `head` of a singly linked list where elements are sorted in
88
**ascending order** , convert _it to a_** _height-balanced_** _binary search
99
tree_.
1010

11+
12+
1113
**Example 1:**
1214

1315
![](https://assets.leetcode.com/uploads/2020/08/17/linked.jpg)
1416

1517
> Input: head = [-10,-3,0,5,9]
16-
>
18+
>
1719
> Output: [0,-3,9,-10,null,5]
18-
>
20+
>
1921
> Explanation: One possible answer is [0,-3,9,-10,null,5], which represents the shown height balanced BST.
2022
2123
**Example 2:**
2224

2325
> Input: head = []
24-
>
26+
>
2527
> Output: []
2628
2729
**Constraints:**
2830

29-
- The number of nodes in `head` is in the range `[0, 2 * 10^4]`.
30-
- `-10^5 <= Node.val <= 10^5`
31+
* The number of nodes in `head` is in the range `[0, 2 * 104]`.
32+
* `-10^5 <= Node.val <= 10^5`
33+
3134

3235
## 题目大意
3336

34-
给定一个单链表的头节点 `head` ,其中的元素 **按升序排序** ,将其转换为 平衡 二叉搜索树。
37+
给定一个单链表的头节点 `head` ,其中的元素 **按升序排序** ,将其转换为 平衡 二叉搜索树。
38+
39+
3540

3641
**示例 1:**
3742

3843
![](https://assets.leetcode.com/uploads/2020/08/17/linked.jpg)
3944

45+
>
46+
>
47+
>
48+
>
49+
>
4050
> **输入:** head = [-10,-3,0,5,9]
41-
>
51+
>
4252
> **输出:** [0,-3,9,-10,null,5]
43-
>
53+
>
4454
> **解释:** 一个可能的答案是[0,-3,9,-10,null,5],它表示所示的高度平衡的二叉搜索树。
55+
>
56+
>
4557
4658
**示例 2:**
4759

60+
>
61+
>
62+
>
63+
>
64+
>
4865
> **输入:** head = []
49-
>
66+
>
5067
> **输出:** []
68+
>
69+
>
70+
71+
5172

5273
**提示:**
5374

54-
- `head` 中的节点数在`[0, 2 * 10^4]` 范围内
55-
- `-10^5 <= Node.val <= 10^5`
75+
* `head` 中的节点数在`[0, 2 * 104]` 范围内
76+
* `-10^5 <= Node.val <= 10^5`
77+
5678

5779
## 解题思路
5880

assets/output/0111.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,29 @@ Given a binary tree, find its minimum depth.
99
The minimum depth is the number of nodes along the shortest path from the root
1010
node down to the nearest leaf node.
1111

12-
**Note:** A leaf is a node with no children.
12+
**Note:** A leaf is a node with no children.
13+
14+
1315

1416
**Example 1:**
1517

1618
![](https://assets.leetcode.com/uploads/2020/10/12/ex_depth.jpg)
1719

1820
> Input: root = [3,9,20,null,null,15,7]
19-
>
21+
>
2022
> Output: 2
2123
2224
**Example 2:**
2325

2426
> Input: root = [2,null,3,null,4,null,5,null,6]
25-
>
27+
>
2628
> Output: 5
2729
2830
**Constraints:**
2931

30-
- The number of nodes in the tree is in the range `[0, 10^5]`.
31-
- `-1000 <= Node.val <= 1000`
32+
* The number of nodes in the tree is in the range `[0, 105]`.
33+
* `-1000 <= Node.val <= 1000`
34+
3235

3336
## 题目大意
3437

@@ -42,20 +45,35 @@ node down to the nearest leaf node.
4245

4346
![](https://assets.leetcode.com/uploads/2020/10/12/ex_depth.jpg)
4447

48+
>
49+
>
50+
>
51+
>
52+
>
4553
> **输入:** root = [3,9,20,null,null,15,7]
46-
>
54+
>
4755
> **输出:** 2
56+
>
57+
>
4858
4959
**示例 2:**
5060

61+
>
62+
>
63+
>
64+
>
65+
>
5166
> **输入:** root = [2,null,3,null,4,null,5,null,6]
52-
>
67+
>
5368
> **输出:** 5
69+
>
70+
>
5471
5572
**提示:**
5673

57-
- 树中节点数的范围在 `[0, 10^5]`
58-
- `-1000 <= Node.val <= 1000`
74+
* 树中节点数的范围在 `[0, 105]`
75+
* `-1000 <= Node.val <= 1000`
76+
5977

6078
## 解题思路
6179

assets/output/0112.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ A **leaf** is a node with no children.
145145
| 113 | [路径总和 II](https://leetcode.com/problems/path-sum-ii) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0113) | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`回溯`](/leetcode/outline/tag/backtracking.md) `1+` | <font color=#ffb800>Medium</font> |
146146
| 124 | [二叉树中的最大路径和](https://leetcode.com/problems/binary-tree-maximum-path-sum) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0124) | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`动态规划`](/leetcode/outline/tag/dynamic-programming.md) `1+` | <font color=#ff334b>Hard</font> |
147147
| 129 | [求根节点到叶节点数字之和](https://leetcode.com/problems/sum-root-to-leaf-numbers) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0129) | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`二叉树`](/leetcode/outline/tag/binary-tree.md) | <font color=#ffb800>Medium</font> |
148-
| 437 | [路径总和 III](https://leetcode.com/problems/path-sum-iii) | | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`二叉树`](/leetcode/outline/tag/binary-tree.md) | <font color=#ffb800>Medium</font> |
148+
| 437 | [路径总和 III](https://leetcode.com/problems/path-sum-iii) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0437) | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`二叉树`](/leetcode/outline/tag/binary-tree.md) | <font color=#ffb800>Medium</font> |
149149
| 666 | [路径总和 IV](https://leetcode.com/problems/path-sum-iv) | | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`数组`](/leetcode/outline/tag/array.md) `2+` | <font color=#ffb800>Medium</font> |
150150

151151
<style>

assets/output/0113.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ leaf node. A **leaf** is a node with no children.
125125
| :------: | :------ | :------: | :------ | :------ |
126126
| 112 | [路径总和](https://leetcode.com/problems/path-sum) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0112) | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`广度优先搜索`](/leetcode/outline/tag/breadth-first-search.md) `1+` | <font color=#15bd66>Easy</font> |
127127
| 257 | [二叉树的所有路径](https://leetcode.com/problems/binary-tree-paths) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0257) | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`字符串`](/leetcode/outline/tag/string.md) `2+` | <font color=#15bd66>Easy</font> |
128-
| 437 | [路径总和 III](https://leetcode.com/problems/path-sum-iii) | | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`二叉树`](/leetcode/outline/tag/binary-tree.md) | <font color=#ffb800>Medium</font> |
128+
| 437 | [路径总和 III](https://leetcode.com/problems/path-sum-iii) | [[]](https://2xiao.github.io/leetcode-js/leetcode/problem/0437) | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`二叉树`](/leetcode/outline/tag/binary-tree.md) | <font color=#ffb800>Medium</font> |
129129
| 666 | [路径总和 IV](https://leetcode.com/problems/path-sum-iv) | | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`数组`](/leetcode/outline/tag/array.md) `2+` | <font color=#ffb800>Medium</font> |
130130
| 2096 | [从二叉树一个节点到另一个节点每一步的方向](https://leetcode.com/problems/step-by-step-directions-from-a-binary-tree-node-to-another) | | [``](/leetcode/outline/tag/tree.md) [`深度优先搜索`](/leetcode/outline/tag/depth-first-search.md) [`字符串`](/leetcode/outline/tag/string.md) `1+` | <font color=#ffb800>Medium</font> |
131131

0 commit comments

Comments
 (0)