Skip to content

Commit c18c69d

Browse files
authored
feat:增加前置知识标签 (azl397985856#388)
1 parent f4d8cd3 commit c18c69d

File tree

74 files changed

+319
-1
lines changed

Some content is hidden

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

74 files changed

+319
-1
lines changed

problems/101.symmetric-tree.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ https://leetcode-cn.com/problems/symmetric-tree/
3333
3434
3535
```
36+
## 前置知识
37+
38+
- 二叉树
39+
- 递归
3640

3741
## 思路
3842

problems/102.binary-tree-level-order-traversal.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ https://leetcode.com/problems/binary-tree-level-order-traversal/description/
2525
]
2626
```
2727

28+
## 前置知识
29+
30+
- 队列
31+
2832
## 思路
2933

3034
这是一个典型的二叉树遍历问题, 关于二叉树遍历,我总结了一个[专题](https://github.com/azl397985856/leetcode/blob/master/thinkings/binary-tree-traversal.md),大家可以先去看下那个,然后再来刷这道题。

problems/103.binary-tree-zigzag-level-order-traversal.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ return its zigzag level order traversal as:
2323
]
2424
```
2525

26+
## 前置知识
27+
28+
- 队列
29+
2630
## 思路
2731

2832
这道题可以借助`队列`实现,首先把root入队,然后入队一个特殊元素Null(来表示每层的结束)。

problems/104.maximum-depth-of-binary-tree.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ return its depth = 3.
2424
2525
```
2626

27+
## 前置知识
28+
29+
- 递归
30+
2731
## 思路
2832

2933
由于树是一种递归的数据结构,因此用递归去解决的时候往往非常容易,这道题恰巧也是如此,

problems/105.Construct-Binary-Tree-from-Preorder-and-Inorder-Traversal.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Return the following binary tree:
2626
15 7
2727
```
2828

29+
## 前置知识
30+
31+
- 二叉树
32+
2933
## 思路/Thinking Path
3034

3135
目标是构造二叉树。

problems/113.path-sum-ii.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Return:
2626
]
2727
```
2828

29+
## 前置知识
30+
31+
- 回溯法
32+
2933
## 思路
3034

3135
这道题目是求集合,并不是`求值`,而是枚举所有可能,因此动态规划不是特别切合,因此我们需要考虑别的方法。

problems/121.best-time-to-buy-and-sell-stock.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ Output: 0
2424
Explanation: In this case, no transaction is done, i.e. max profit = 0.
2525
```
2626

27+
## 前置知识
28+
29+
- 数组
30+
2731
## 思路
2832

2933
由于我们是想获取到最大的利润,我们的策略应该是低点买入,高点卖出。

problems/122.best-time-to-buy-and-sell-stock-ii.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Output: 0
3131
Explanation: In this case, no transaction is done, i.e. max profit = 0.
3232
```
3333

34+
## 前置知识
35+
36+
- 数组
37+
3438
## 思路
3539

3640
由于我们是想获取到最大的利润,我们的策略应该是低点买入,高点卖出。

problems/124.binary-tree-maximum-path-sum.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ Input: [-10,9,20,null,null,15,7]
3131
Output: 42
3232
```
3333

34+
## 前置知识
35+
36+
- 递归
37+
3438
## 思路
3539

3640
这道题目的path让我误解了,然后浪费了很多时间来解这道题

problems/125.valid-palindrome.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ Output: false
2121
2222
```
2323

24+
## 前置知识
25+
26+
- 回文
27+
- 双指针
28+
2429
## 思路
2530

2631
这是一道考察回文的题目,而且是最简单的形式,即判断一个字符串是否是回文。

0 commit comments

Comments
 (0)