标签:col type 状态 not for obj pre etc return
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
if not prices:
return 0
buy = -prices[0]
sell = 0
for i in range(1,len(prices)):
buy = max(buy ,-prices[i])
sell = max (sell,prices[i] + buy)
return sell
标签:col type 状态 not for obj pre etc return
原文地址:https://www.cnblogs.com/lux-ace/p/10546508.html