class Solution:
    def maxProfit(self, prices, fee):
        """
        :type prices: List[int]
        :type fee: int
        :rtype: int
        """
        m=len(prices)
        buy=[0]*(m+1)
        sell=[0]*(m+1)

        buy[0]=-9999999999

        for i in range(1,m+1):
        	buy[i]=max(buy[i-1],sell[i-1]-prices[i-1]-fee)    #什么都不做/买股票
        	sell[i]=max(sell[i-1],buy[i-1]+prices[i-1])       #什么都不做/卖股票
        return sell[m]

7bd8eda41671eb547981d88ef3870d5dae5b462e
<mask token>

class Solution:
    <mask token>

class Solution:

    def maxProfit(self, prices, fee):
        """
        :type prices: List[int]
        :type fee: int
        :rtype: int
        """
        m = len(prices)
        buy = [0] * (m + 1)
        sell = [0] * (m + 1)
        buy[0] = -9999999999
        for i in range(1, m + 1):
            buy[i] = max(buy[i - 1], sell[i - 1] - prices[i - 1] - fee)
            sell[i] = max(sell[i - 1], buy[i - 1] + prices[i - 1])
        return sell[m]

class Solution:
    def maxProfit(self, prices, fee):
        """
        :type prices: List[int]
        :type fee: int
        :rtype: int
        """
        m=len(prices)
        buy=[0]*(m+1)
        sell=[0]*(m+1)

        buy[0]=-9999999999

        for i in range(1,m+1):
        	buy[i]=max(buy[i-1],sell[i-1]-prices[i-1]-fee)    #什么都不做/买股票
        	sell[i]=max(sell[i-1],buy[i-1]+prices[i-1])       #什么都不做/卖股票
        return sell[m]
