4
4
# comments: This program output the
5
5
# best time to buy and sell stock with fees
6
6
#############################
7
- from typing import List
7
+ # from typing import list
8
8
9
9
10
10
class Solution :
11
11
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 ]]
13
13
) -> int :
14
14
"""
15
15
Calculate the maximum profit with the given parameters.
16
16
17
- :param prices: List of prices for each day.
17
+ :param prices: list of prices for each day.
18
18
:param index: Current day index.
19
19
:param fee: Transaction fee.
20
20
:param buy: Buy or sell flag (1 for buy, 0 for sell).
@@ -41,12 +41,12 @@ def solve(
41
41
dp [index ][buy ] = profit
42
42
return profit
43
43
44
- def maxprofit (self , prices : List [int ], fee : int ) -> int :
44
+ def maxprofit (self , prices : list [int ], fee : int ) -> int :
45
45
"""
46
46
Calculate the maximum profit achievable when buying and
47
47
selling stocks with a fee.
48
48
49
- :param prices: List of stock prices for each day.
49
+ :param prices: list of stock prices for each day.
50
50
:param fee: Transaction fee.
51
51
:return: Maximum profit achievable.
52
52
"""
0 commit comments