您当前的位置: 首页 > 

123. 买卖股票的最佳时机 III

宝哥大数据 发布时间:2019-10-24 15:09:58 ,浏览量:2

123. 买卖股票的最佳时机 III 题目描述 在这里插入图片描述

错误的方法:此处我错误的考虑为连续的利润
class Solution:
    def maxProfit(self, prices: List[int]) -> int:    
        
        preProfit = 0
        profits = []
        for i in range(1, len(prices)):
            curProfit = prices[i] - prices[i-1]
            
            if curProfit > 0:
                if preProfit             
关注
打赏
1688896170
查看更多评论
0.0700s