Skip to content

Commit

Permalink
Update 动态规划-股票问题总结篇.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hengzzha authored Jul 2, 2021
1 parent 15582ef commit 6360e80
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions problems/动态规划-股票问题总结篇.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ dp[i][1] = max(dp[i - 1][1], dp[i - 1][3]);
dp[i][2] = dp[i - 1][0] + prices[i];
dp[i][3] = dp[i - 1][2];
```
```C++
dp[i][0] = max(dp[i - 1][0], max(dp[i - 1][3]- prices[i], dp[i - 1][1]) - prices[i];
dp[i][1] = max(dp[i - 1][1], dp[i - 1][3]);
dp[i][2] = dp[i - 1][0] + prices[i];
dp[i][3] = dp[i - 1][2];
```

整体代码如下:

Expand Down

0 comments on commit 6360e80

Please sign in to comment.