買賣股票的最佳時機 II

核心思想:因爲可以多次交易,只要將兩天股票價格之差大於0的求和即可,時間複雜度O(n),空間複雜度O(1) class Solution(object):     def maxProfit(self, prices):         """         :type prices: List[int]         :rtype: int         """         if le
相關文章
相關標籤/搜索