只买卖一次,只需要纪录过去的日子里最便宜的价格,计算当前的利润

class Solution:
    def maxProfit(self , prices ):
        # write code here
        buymin = prices[0]
        profit = 0
        for p in prices:
            profit = max(profit, p - buymin)
            buymin = min(buymin, p)
        return profit