class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
profit = 0
min_value = prices[0]
for i in range(1, len(prices)):
profit = max(profit, prices[i]-min_value)
min_value = min(min_value, prices[i])
return profit