Skip to content

Commit

Permalink
Batch-3/Neetcode-All/Added-articles (#3765)
Browse files Browse the repository at this point in the history
  • Loading branch information
Srihari2222 authored Dec 10, 2024
1 parent dd3a60f commit fdaf14b
Show file tree
Hide file tree
Showing 23 changed files with 7,982 additions and 6 deletions.
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

0 comments on commit fdaf14b

Please sign in to comment.