题目描述:
方法一:
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