Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2691e27

Browse files
Merge pull request youngyangyang04#2208 from jinbudaily/master
更新 动态规划篇章 排版格式修复
2 parents 1340cc3 + 04dd0ec commit 2691e27

File tree

46 files changed

+341
-300
lines changed

Some content is hidden

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

46 files changed

+341
-300
lines changed

‎problems/0070.爬楼梯.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
* 1 阶 + 2 阶
3030
* 2 阶 + 1 阶
3131

32-
#视频讲解
32+
## 算法公开课
3333

34-
**《代码随想录》算法视频公开课:[带你学透动态规划-爬楼梯|LeetCode:70.爬楼梯)](https://www.bilibili.com/video/BV17h411h7UH),相信结合视频在看本篇题解,更有助于大家对本题的理解**
34+
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[带你学透动态规划-爬楼梯|LeetCode:70.爬楼梯)](https://www.bilibili.com/video/BV17h411h7UH),相信结合视频在看本篇题解,更有助于大家对本题的理解**
3535

3636

3737
## 思路
@@ -522,3 +522,4 @@ impl Solution {
522522
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
523523
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
524524
</a>
525+

‎problems/0070.爬楼梯完全背包版本.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ public:
127127
128128
## 其他语言版本
129129
130+
### Java:
130131
131-
Java:
132132
```java
133133
class Solution {
134134
public int climbStairs(int n) {
@@ -148,7 +148,7 @@ class Solution {
148148
}
149149
```
150150

151-
Python3:
151+
### Python3:
152152

153153

154154
```python
@@ -166,8 +166,8 @@ class Solution:
166166
return dp[n]
167167
```
168168

169+
### Go:
169170

170-
Go:
171171
```go
172172
func climbStairs(n int) int {
173173
//定义
@@ -189,7 +189,8 @@ func climbStairs(n int) int {
189189
}
190190
```
191191

192-
JavaScript:
192+
### JavaScript:
193+
193194
```javascript
194195
var climbStairs = function(n) {
195196
const dp = new Array(n + 1).fill(0);
@@ -206,7 +207,7 @@ var climbStairs = function(n) {
206207
};
207208
```
208209

209-
TypeScript:
210+
### TypeScript:
210211

211212
```typescript
212213
function climbStairs(n: number): number {
@@ -226,7 +227,7 @@ function climbStairs(n: number): number {
226227
};
227228
```
228229

229-
Rust:
230+
### Rust:
230231

231232
```rust
232233
impl Solution {
@@ -250,4 +251,3 @@ impl Solution {
250251
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
251252
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
252253
</a>
253-

‎problems/0072.编辑距离.md‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ exection -> execution (插入 'u')
4040
* 0 <= word1.length, word2.length <= 500
4141
* word1 和 word2 由小写英文字母组成
4242

43-
# 算法公开课
44-
**《代码随想录》算法视频公开课:[动态规划终极绝杀! LeetCode:72.编辑距离](https://www.bilibili.com/video/BV1we4y157wB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**
43+
## 算法公开课
44+
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[动态规划终极绝杀! LeetCode:72.编辑距离](https://www.bilibili.com/video/BV1we4y157wB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**
4545

4646
## 思路
4747

@@ -227,8 +227,8 @@ public:
227227
228228
## 其他语言版本
229229
230+
### Java:
230231
231-
Java:
232232
```java
233233
public int minDistance(String word1, String word2) {
234234
int m = word1.length();
@@ -256,7 +256,8 @@ public int minDistance(String word1, String word2) {
256256
}
257257
```
258258

259-
Python:
259+
### Python:
260+
260261
```python
261262
class Solution:
262263
def minDistance(self, word1: str, word2: str) -> int:
@@ -274,7 +275,8 @@ class Solution:
274275
return dp[-1][-1]
275276
```
276277

277-
Go:
278+
### Go:
279+
278280
```Go
279281
func minDistance(word1 string, word2 string) int {
280282
m, n := len(word1), len(word2)
@@ -310,8 +312,8 @@ func Min(args ...int) int {
310312
}
311313
```
312314

315+
### Javascript:
313316

314-
Javascript:
315317
```javascript
316318
const minDistance = (word1, word2) => {
317319
let dp = Array.from(Array(word1.length + 1), () => Array(word2.length+1).fill(0));
@@ -338,7 +340,7 @@ const minDistance = (word1, word2) => {
338340
};
339341
```
340342

341-
TypeScript:
343+
### TypeScript:
342344

343345
```typescript
344346
function minDistance(word1: string, word2: string): number {
@@ -373,7 +375,7 @@ function minDistance(word1: string, word2: string): number {
373375
};
374376
```
375377

376-
C:
378+
### C:
377379

378380

379381
```c
@@ -405,3 +407,4 @@ int minDistance(char * word1, char * word2){
405407
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
406408
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
407409
</a>
410+

‎problems/0115.不同的子序列.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ public:
157157
158158
## 其他语言版本
159159
160+
### Java:
160161
161-
Java:
162162
```java
163163
class Solution {
164164
public int numDistinct(String s, String t) {
@@ -182,7 +182,8 @@ class Solution {
182182
}
183183
```
184184

185-
Python:
185+
### Python:
186+
186187
```python
187188
class Solution:
188189
def numDistinct(self, s: str, t: str) -> int:
@@ -200,7 +201,8 @@ class Solution:
200201
return dp[-1][-1]
201202
```
202203

203-
Python3:
204+
### Python3:
205+
204206
```python
205207
class SolutionDP2:
206208
"""
@@ -234,7 +236,8 @@ class SolutionDP2:
234236
return dp[-1]
235237
```
236238

237-
Go:
239+
### Go:
240+
238241
```go
239242
func numDistinct(s string, t string) int {
240243
dp:= make([][]int,len(s)+1)
@@ -259,8 +262,8 @@ func numDistinct(s string, t string) int {
259262
}
260263
```
261264

265+
### Javascript:
262266

263-
Javascript:
264267
```javascript
265268
const numDistinct = (s, t) => {
266269
let dp = Array.from(Array(s.length + 1), () => Array(t.length +1).fill(0));
@@ -283,7 +286,7 @@ const numDistinct = (s, t) => {
283286
};
284287
```
285288

286-
TypeScript:
289+
### TypeScript:
287290

288291
```typescript
289292
function numDistinct(s: string, t: string): number {
@@ -312,9 +315,8 @@ function numDistinct(s: string, t: string): number {
312315
```
313316

314317

315-
316-
317318
<p align="center">
318319
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
319320
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
320321
</a>
322+

‎problems/0121.买卖股票的最佳时机.md‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424
* 输出:0
2525
解释:在这种情况下, 没有交易完成, 所以最大利润为 0。
2626

27-
# 算法公开课
28-
29-
**《代码随想录》算法视频公开课:[动态规划之 LeetCode:121.买卖股票的最佳时机1](https://www.bilibili.com/video/BV1Xe4y1u77q),相信结合视频再看本篇题解,更有助于大家对本题的理解**
30-
27+
## 算法公开课
3128

29+
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[动态规划之 LeetCode:121.买卖股票的最佳时机1](https://www.bilibili.com/video/BV1Xe4y1u77q),相信结合视频再看本篇题解,更有助于大家对本题的理解**
3230

3331
## 思路
3432

@@ -202,7 +200,7 @@ public:
202200

203201
## 其他语言版本
204202

205-
Java:
203+
### Java:
206204

207205
> 贪心法:
208206

@@ -294,8 +292,7 @@ class Solution {
294292
295293
```
296294

297-
298-
Python:
295+
### Python:
299296

300297
> 贪心法:
301298
```python
@@ -351,7 +348,8 @@ class Solution:
351348
return dp1
352349
```
353350

354-
Go:
351+
### Go:
352+
355353
> 贪心法:
356354
```Go
357355
func maxProfit(prices []int) int {
@@ -418,7 +416,7 @@ func max(a, b int) int {
418416
}
419417
```
420418

421-
JavaScript:
419+
### JavaScript:
422420

423421
> 动态规划
424422
@@ -454,7 +452,7 @@ var maxProfit = function(prices) {
454452
};
455453
```
456454

457-
TypeScript:
455+
### TypeScript:
458456

459457
> 贪心法
460458
@@ -492,7 +490,7 @@ function maxProfit(prices: number[]): number {
492490
};
493491
```
494492

495-
C#:
493+
### C#:
496494

497495
> 贪心法
498496
@@ -533,7 +531,7 @@ public class Solution
533531
}
534532
```
535533

536-
Rust:
534+
### Rust:
537535

538536
> 贪心
539537

‎problems/0122.买卖股票的最佳时机II(动态规划).md‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
* 1 <= prices.length <= 3 * 10 ^ 4
3535
* 0 <= prices[i] <= 10 ^ 4
3636

37-
# 算法公开课
37+
## 算法公开课
3838

39-
**《代码随想录》算法视频公开课:[动态规划,股票问题第二弹 | LeetCode:122.买卖股票的最佳时机II](https://www.bilibili.com/video/BV1D24y1Q7Ls),相信结合视频再看本篇题解,更有助于大家对本题的理解**
39+
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html):[动态规划,股票问题第二弹 | LeetCode:122.买卖股票的最佳时机II](https://www.bilibili.com/video/BV1D24y1Q7Ls),相信结合视频再看本篇题解,更有助于大家对本题的理解**
4040

4141

4242
## 思路
@@ -133,8 +133,8 @@ public:
133133

134134
## 其他语言版本
135135

136+
### Java:
136137

137-
Java:
138138
```java
139139
// 动态规划
140140
class Solution
@@ -191,7 +191,7 @@ class Solution {
191191
}
192192
```
193193

194-
Python:
194+
### Python:
195195

196196
> 版本一:
197197
```python
@@ -221,7 +221,8 @@ class Solution:
221221
return dp[(length-1) % 2][1]
222222
```
223223

224-
Go:
224+
### Go:
225+
225226
```go
226227
// 买卖股票的最佳时机II 动态规划
227228
// 时间复杂度:O(n) 空间复杂度:O(n)
@@ -250,7 +251,8 @@ func max(a, b int) int {
250251
}
251252
```
252253

253-
Javascript:
254+
### JavaScript:
255+
254256
```javascript
255257
// 方法一:动态规划(dp 数组)
256258
const maxProfit = (prices) => {
@@ -290,7 +292,7 @@ const maxProfit = (prices) => {
290292
}
291293
```
292294

293-
TypeScript:
295+
### TypeScript:
294296

295297
> 动态规划
296298

@@ -326,7 +328,7 @@ function maxProfit(prices: number[]): number {
326328
};
327329
```
328330

329-
C#:
331+
### C#:
330332

331333
> 贪心法
332334
@@ -363,7 +365,7 @@ public class Solution
363365
}
364366
```
365367

366-
Rust:
368+
### Rust:
367369

368370
> 贪心
369371
@@ -414,4 +416,3 @@ impl Solution {
414416
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
415417
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
416418
</a>
417-

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /