贪心计算爬峰收益
class Solution:
def maxProfit(self, prices: List[int]) -> int:
ans, l = 0, len(prices)
for i in range(1, l): ans += max(0, prices[i] - prices[i - 1])
return ans
原创文章,作者:jamestackk,如若转载,请注明出处:https://blog.ytso.com/270706.html