LeetCode122. 买卖股票的最佳时机 II
题目链接
https://leetcode.cn/problems/best-time-to-buy-and-sell-stock-ii/

代码
class Solution:def maxProfit(self, prices: List[int]) -> int:result = 0for i in range(1, len(prices)):result += max((prices[i] - prices[i - 1]), 0)return result