Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions articles/buy-and-sell-crypto-with-cooldown.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ class Solution:
for i in range(n - 1, -1, -1):
dp_buy = max(dp1_sell - prices[i], dp1_buy)
dp_sell = max(dp2_buy + prices[i], dp1_sell)
dp2_buy, dp1_sell = dp1_buy, dp1_sell
dp2_buy = dp1_buy
dp1_buy, dp1_sell = dp_buy, dp_sell

return dp1_buy
Expand All @@ -651,7 +651,6 @@ public class Solution {
int dp_buy = Math.max(dp1_sell - prices[i], dp1_buy);
int dp_sell = Math.max(dp2_buy + prices[i], dp1_sell);
dp2_buy = dp1_buy;
dp1_sell = dp1_sell;
dp1_buy = dp_buy;
dp1_sell = dp_sell;
}
Expand All @@ -673,7 +672,6 @@ public:
int dp_buy = max(dp1_sell - prices[i], dp1_buy);
int dp_sell = max(dp2_buy + prices[i], dp1_sell);
dp2_buy = dp1_buy;
dp1_sell = dp1_sell;
dp1_buy = dp_buy;
dp1_sell = dp_sell;
}
Expand All @@ -698,7 +696,6 @@ class Solution {
let dp_buy = Math.max(dp1_sell - prices[i], dp1_buy);
let dp_sell = Math.max(dp2_buy + prices[i], dp1_sell);
dp2_buy = dp1_buy;
dp1_sell = dp1_sell;
dp1_buy = dp_buy;
dp1_sell = dp_sell;
}
Expand All @@ -719,7 +716,6 @@ public class Solution {
int dp_buy = Math.Max(dp1_sell - prices[i], dp1_buy);
int dp_sell = Math.Max(dp2_buy + prices[i], dp1_sell);
dp2_buy = dp1_buy;
dp1_sell = dp1_sell;
dp1_buy = dp_buy;
dp1_sell = dp_sell;
}
Expand Down
Loading