leetcode-122-买卖股票的最佳时机②
题目描述:


方法一:
class Solution: def maxProfit(self, prices: List[int]) -> int: profit = 0 for i in range(1,len(prices)): tem = prices[i] - prices[i-1] if tem>0: profit += tem return profit
题目描述:


方法一:
class Solution: def maxProfit(self, prices: List[int]) -> int: profit = 0 for i in range(1,len(prices)): tem = prices[i] - prices[i-1] if tem>0: profit += tem return profit