ICode9

精准搜索请尝试: 精确搜索
  • LeetCode122 买卖股票的最佳时机 II(贪心)2022-06-29 13:31:23

    LeetCode122 买卖股票的最佳时机 II 贪心计算爬峰收益 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

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有