Skip to content

Commit 9382a88

Browse files
committed
The best time to buy and sell stock is added in DP section with annotations (TheAlgorithms#7104)
1 parent 599a89d commit 9382a88

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

dynamic_programming/best_time_to_buy_sell_stock.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
# comments: This program output the
55
# best time to buy and sell stock with fees
66
#############################
7-
from typing import List
7+
# from typing import list
88

99

1010
class Solution:
1111
def solve(
12-
self, prices: List[int], index: int, fee: int, buy: int, dp: List[List[int]]
12+
self, prices: list[int], index: int, fee: int, buy: int, dp: list[list[int]]
1313
) -> int:
1414
"""
1515
Calculate the maximum profit with the given parameters.
1616
17-
:param prices: List of prices for each day.
17+
:param prices: list of prices for each day.
1818
:param index: Current day index.
1919
:param fee: Transaction fee.
2020
:param buy: Buy or sell flag (1 for buy, 0 for sell).
@@ -41,12 +41,12 @@ def solve(
4141
dp[index][buy] = profit
4242
return profit
4343

44-
def maxprofit(self, prices: List[int], fee: int) -> int:
44+
def maxprofit(self, prices: list[int], fee: int) -> int:
4545
"""
4646
Calculate the maximum profit achievable when buying and
4747
selling stocks with a fee.
4848
49-
:param prices: List of stock prices for each day.
49+
:param prices: list of stock prices for each day.
5050
:param fee: Transaction fee.
5151
:return: Maximum profit achievable.
5252
"""

0 commit comments

Comments
 (0)