Skip to content

Commit f3d012c

Browse files
committed
add some jz_offer problems
1 parent 9510fa7 commit f3d012c

Some content is hidden

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

82 files changed

+1428
-743
lines changed

assets/output/jz_offer_10_1.md

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [10 - I. 斐波那契数列](https://leetcode.cn/problems/fei-bo-na-qi-shu-lie-lcof)
1+
# [10-I. 斐波那契数列](https://leetcode.cn/problems/fei-bo-na-qi-shu-lie-lcof)
22

33
🟢 <font color=#15bd66>Easy</font>&emsp; 🔖&ensp; [`记忆化搜索`](/tag/memoization.md) [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md)&emsp; 🔗&ensp;[`LeetCode`](https://leetcode.cn/problems/fei-bo-na-qi-shu-lie-lcof)
44

@@ -7,82 +7,46 @@
77
English description is not available for the problem. Please switch to
88
Chinese.
99

10-
1110
## 题目大意
1211

1312
**斐波那契数** (通常用 `F(n)` 表示)形成的序列称为 **斐波那契数列** 。该数列由 **0****1**
1413
开始,后面的每一项数字都是前面两项数字的和。也就是:
1514

16-
>
17-
>
18-
>
19-
>
20-
>
2115
> F(0) = 0,F(1) = 1
22-
>
16+
>
2317
> F(n) = F(n - 1) + F(n - 2),其中 n > 1
24-
>
25-
>
2618
2719
给定 `n` ,请计算 `F(n)`
2820

2921
答案需要取模 1e9+7(1000000007) ,如计算初始结果为:1000000008,请返回 1。
3022

31-
32-
3323
**示例 1:**
3424

35-
>
36-
>
37-
>
38-
>
39-
>
4025
> **输入:** n = 2
41-
>
26+
>
4227
> **输出:** 1
43-
>
28+
>
4429
> **解释:** F(2) = F(1) + F(0) = 1 + 0 = 1
45-
>
46-
>
4730
4831
**示例 2:**
4932

50-
>
51-
>
52-
>
53-
>
54-
>
5533
> **输入:** n = 3
56-
>
34+
>
5735
> **输出:** 2
58-
>
36+
>
5937
> **解释:** F(3) = F(2) + F(1) = 1 + 1 = 2
60-
>
61-
>
6238
6339
**示例 3:**
6440

65-
>
66-
>
67-
>
68-
>
69-
>
7041
> **输入:** n = 4
71-
>
42+
>
7243
> **输出:** 3
73-
>
44+
>
7445
> **解释:** F(4) = F(3) + F(2) = 2 + 1 = 3
75-
>
76-
>
77-
78-
7946
8047
**提示:**
8148

82-
* `0 <= n <= 100`
83-
84-
85-
49+
- `0 <= n <= 100`
8650

8751
## 解题思路
8852

@@ -95,4 +59,4 @@ Chinese.
9559

9660
```javascript
9761

98-
```
62+
```

assets/output/jz_offer_10_2.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [10 - II. 青蛙跳台阶问题](https://leetcode.cn/problems/qing-wa-tiao-tai-jie-wen-ti-lcof)
1+
# [10-II. 青蛙跳台阶问题](https://leetcode.cn/problems/qing-wa-tiao-tai-jie-wen-ti-lcof)
22

33
🟢 <font color=#15bd66>Easy</font>&emsp; 🔖&ensp; [`记忆化搜索`](/tag/memoization.md) [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md)&emsp; 🔗&ensp;[`LeetCode`](https://leetcode.cn/problems/qing-wa-tiao-tai-jie-wen-ti-lcof)
44

@@ -7,7 +7,6 @@
77
English description is not available for the problem. Please switch to
88
Chinese.
99

10-
1110
## 题目大意
1211

1312
今天的有氧运动训练内容是在一个长条形的平台上跳跃。平台有 `num` 个小格子,每次可以选择跳 **一个格子** 或者 **两个格子**
@@ -17,39 +16,22 @@ Chinese.
1716

1817
**示例 1:**
1918

20-
>
21-
>
22-
>
23-
>
24-
>
2519
> **输入:** n = 2
26-
>
20+
>
2721
> **输出:** 2
28-
>
29-
>
3022
3123
**示例 2:**
3224

33-
>
34-
>
35-
>
36-
>
37-
>
3825
> **输入:** n = 5
39-
>
26+
>
4027
> **输出:** 8
41-
>
42-
>
43-
44-
4528
4629
**提示:**
4730

48-
* `0 <= n <= 100`
31+
- `0 <= n <= 100`
4932

5033
注意:本题与主站 70 题相同:<https://leetcode-cn.com/problems/climbing-stairs/>
5134

52-
5335
## 解题思路
5436

5537
#### 复杂度分析
@@ -61,4 +43,4 @@ Chinese.
6143

6244
```javascript
6345

64-
```
46+
```

assets/output/jz_offer_14_1.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [14 - I. 剪绳子](https://leetcode.cn/problems/jian-sheng-zi-lcof)
1+
# [14-I. 剪绳子](https://leetcode.cn/problems/jian-sheng-zi-lcof)
22

33
🟠 <font color=#ffb800>Medium</font>&emsp; 🔖&ensp; [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md)&emsp; 🔗&ensp;[`LeetCode`](https://leetcode.cn/problems/jian-sheng-zi-lcof)
44

@@ -7,33 +7,22 @@
77
English description is not available for the problem. Please switch to
88
Chinese.
99

10-
1110
## 题目大意
1211

1312
现需要将一根长为正整数 `bamboo_len` 的竹子砍为若干段,每段长度均为正整数。请返回每段竹子长度的最大乘积是多少。
1413

15-
16-
1714
**示例 1:**
1815

19-
>
20-
>
21-
>
22-
>
23-
>
24-
> **输入:** bamboo_len**** =**** 12
25-
>
16+
> **输入:** bamboo_len\***\* =\*\*** 12
17+
>
2618
> **输出:** 81
27-
>
28-
>
2919
3020
**提示:**
3121

32-
* `2 <= bamboo_len <= 58`
22+
- `2 <= bamboo_len <= 58`
3323

3424
注意:本题与主站 343 题相同:<https://leetcode-cn.com/problems/integer-break/>
3525

36-
3726
## 解题思路
3827

3928
#### 复杂度分析
@@ -45,4 +34,4 @@ Chinese.
4534

4635
```javascript
4736

48-
```
37+
```

assets/output/jz_offer_14_2.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [14 - II. 剪绳子 II](https://leetcode.cn/problems/jian-sheng-zi-ii-lcof)
1+
# [14-II. 剪绳子 II](https://leetcode.cn/problems/jian-sheng-zi-ii-lcof)
22

33
🟠 <font color=#ffb800>Medium</font>&emsp; 🔖&ensp; [`数学`](/tag/math.md) [`动态规划`](/tag/dynamic-programming.md)&emsp; 🔗&ensp;[`LeetCode`](https://leetcode.cn/problems/jian-sheng-zi-ii-lcof)
44

@@ -7,39 +7,24 @@
77
English description is not available for the problem. Please switch to
88
Chinese.
99

10-
1110
## 题目大意
1211

1312
现需要将一根长为正整数 `bamboo_len` 的竹子砍为若干段,每段长度均为 **正整数** 。请返回每段竹子长度的 **最大乘积** 是多少。
1413

1514
答案需要取模 1e9+7(1000000007),如计算初始结果为:1000000008,请返回 1。
1615

17-
18-
1916
**示例 1:**
2017

21-
>
22-
>
23-
>
24-
>
25-
>
2618
> **输入:** bamboo_len = 12
27-
>
19+
>
2820
> **输出:** 81
29-
>
30-
>
31-
32-
3321
3422
**提示:**
3523

36-
* `2 <= bamboo_len <= 1000`
24+
- `2 <= bamboo_len <= 1000`
3725

3826
注意:本题与主站 343 题相同:<https://leetcode-cn.com/problems/integer-break/>
3927

40-
41-
42-
4328
## 解题思路
4429

4530
#### 复杂度分析
@@ -51,4 +36,4 @@ Chinese.
5136

5237
```javascript
5338

54-
```
39+
```

assets/output/jz_offer_32_1.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [32 - I. 从上到下打印二叉树](https://leetcode.cn/problems/cong-shang-dao-xia-da-yin-er-cha-shu-lcof)
1+
# [32-I. 从上到下打印二叉树](https://leetcode.cn/problems/cong-shang-dao-xia-da-yin-er-cha-shu-lcof)
22

33
🟠 <font color=#ffb800>Medium</font>&emsp; 🔖&ensp; [``](/tag/tree.md) [`广度优先搜索`](/tag/breadth-first-search.md) [`二叉树`](/tag/binary-tree.md)&emsp; 🔗&ensp;[`LeetCode`](https://leetcode.cn/problems/cong-shang-dao-xia-da-yin-er-cha-shu-lcof)
44

@@ -7,36 +7,21 @@
77
English description is not available for the problem. Please switch to
88
Chinese.
99

10-
1110
## 题目大意
1211

1312
一棵圣诞树记作根节点为 `root` 的二叉树,节点值为该位置装饰彩灯的颜色编号。请按照从 ******** 的顺序返回每一层彩灯编号。
1413

15-
16-
1714
**示例 1:**
1815

1916
![](https://pic.leetcode.cn/1694758674-XYrUiV-%E5%89%91%E6%8C%87%20Offer%2032%20-%20I_%E7%A4%BA%E4%BE%8B1.png)
2017

21-
>
22-
>
23-
>
24-
>
25-
>
2618
> **输入:** root = [8,17,21,18,null,null,6]
27-
>
19+
>
2820
> **输出:**[8,17,21,18,6]
29-
>
30-
>
31-
32-
3321
3422
**提示:**
3523

36-
1. `节点总数 <= 1000`
37-
38-
39-
24+
1. `节点总数 <= 1000`
4025

4126
## 解题思路
4227

@@ -49,4 +34,4 @@ Chinese.
4934

5035
```javascript
5136

52-
```
37+
```

assets/output/jz_offer_32_2.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [32 - II. 从上到下打印二叉树 II](https://leetcode.cn/problems/cong-shang-dao-xia-da-yin-er-cha-shu-ii-lcof)
1+
# [32-II. 从上到下打印二叉树 II](https://leetcode.cn/problems/cong-shang-dao-xia-da-yin-er-cha-shu-ii-lcof)
22

33
🟢 <font color=#15bd66>Easy</font>&emsp; 🔖&ensp; [``](/tag/tree.md) [`广度优先搜索`](/tag/breadth-first-search.md) [`二叉树`](/tag/binary-tree.md)&emsp; 🔗&ensp;[`LeetCode`](https://leetcode.cn/problems/cong-shang-dao-xia-da-yin-er-cha-shu-ii-lcof)
44

@@ -7,38 +7,25 @@
77
English description is not available for the problem. Please switch to
88
Chinese.
99

10-
1110
## 题目大意
1211

1312
一棵圣诞树记作根节点为 `root` 的二叉树,节点值为该位置装饰彩灯的颜色编号。请按照从左到右的顺序返回每一层彩灯编号,每一层的结果记录于一行。
1413

15-
16-
1714
**示例 1:**
1815

1916
![](https://pic.leetcode.cn/1694758674-XYrUiV-%E5%89%91%E6%8C%87%20Offer%2032%20-%20I_%E7%A4%BA%E4%BE%8B1.png)
2017

21-
>
22-
>
23-
>
24-
>
25-
>
2618
> **输入:** root = [8,17,21,18,null,null,6]
27-
>
19+
>
2820
> **输出:**[[8],[17,21],[18,6]]
29-
>
30-
>
3121
3222
**提示:**
3323

34-
1. `节点总数 <= 1000`
24+
1. `节点总数 <= 1000`
3525

3626
注意:本题与主站 102 题相同:<https://leetcode-cn.com/problems/binary-tree-level-order-
3727
traversal/>
3828

39-
40-
41-
4229
## 解题思路
4330

4431
#### 复杂度分析
@@ -50,4 +37,4 @@ traversal/>
5037

5138
```javascript
5239

53-
```
40+
```

0 commit comments

Comments
 (0)