Skip to content

Commit ebc4894

Browse files
author
Partho Biswas
committed
code updated
1 parent c0270a8 commit ebc4894

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

leetcode.com/python/309_Best_Time_to_Buy_and_Sell_Stock_with_Cooldown.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# return totalProfit
2929

3030

31-
# Taken from this: https://tinyurl.com/wlol23f
31+
# Taken from this (Must read): https://tinyurl.com/wlol23f and https://tinyurl.com/syuepe6
3232
class Solution:
3333
def maxProfit(self, prices):
3434
"""
@@ -43,6 +43,7 @@ def maxProfit(self, prices):
4343
have_0_stock_and_buy = 'have 0 stock and buy'
4444
have_0_stock_and_rest = 'have 0 stock and rest'
4545

46+
# The keys of this dictionary is the action taken on 'i'th day and the values represent the possible actions on the 'i + 1' day.
4647
action_to_next_day_possible_actions = {
4748
have_1_stock_and_sell: {have_0_stock_and_rest}, # Cool-down.
4849
have_1_stock_and_keep: {have_1_stock_and_keep, have_1_stock_and_sell},
@@ -97,7 +98,7 @@ def set_max_action_to_gain(_today_actions_to_total_gain, _today_action, _previou
9798
i += 1
9899

99100
last_possible_actions = possible_actions[-1]
100-
# print('last possible actions', last_possible_actions)
101+
print('last possible actions', last_possible_actions)
101102

102103
return max(last_possible_actions.values())
103104

0 commit comments

Comments
 (0)