mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2026-02-02 18:39:09 +08:00
更新图片链接
This commit is contained in:
@@ -77,7 +77,7 @@ dp[0][4] = 0;
|
||||
|
||||
以输入[1,2,3,4,5]为例
|
||||
|
||||

|
||||

|
||||
|
||||
可以看到红色框为最后两次卖出的状态。
|
||||
|
||||
@@ -144,7 +144,7 @@ for (int j = 1; j < 2 * k; j += 2) {
|
||||
以输入[1,2,3,4,5],k=2为例。
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
最后一次卖出,一定是利润最大的,dp[prices.size() - 1][2 * k]即红色部分就是最后求解。
|
||||
|
||||
@@ -197,7 +197,7 @@ vector<vector<int>> dp(n, vector<int>(3, 0));
|
||||
以 [1,2,3,0,2] 为例,dp数组如下:
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
最后两个状态 不持有股票(能购买) 和 不持有股票(冷冻期)都有可能最后结果,取最大的。
|
||||
|
||||
@@ -206,4 +206,4 @@ vector<vector<int>> dp(n, vector<int>(3, 0));
|
||||
下周还会有一篇股票系列的文章,**股票系列后面我也会单独写一篇总结,来高度概括一下,这样大家会对股票问题就有一个整体性的理解了**。
|
||||
|
||||
|
||||
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码.jpg width=450> </img></div>
|
||||
<div align="center"><img src='https://file1.kamacoder.com/i/algo/01二维码.jpg' width=450> </img></div>
|
||||
|
||||
Reference in New Issue
Block a user