class Solution:
def maxProfit(self, prices: List[int], fee: int) -> int:
buytime = prices[0]
maxProfit = 0
for i in range(1, len(prices)):
if prices[i] < buytime:
buytime = prices[i]
if prices[i] > buytime + fee:
maxProfit = maxProfit + prices[i] - buytime - fee
buytime = prices[i] - fee
return maxProfit