Skip to content

Sri Hari: Batch-3/Neetcode-All/Added-articles #3765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy