Best Time to Buy and Sell Stock
Example
class Solution:
"""
@param prices: Given an integer array
@return: Maximum profit
"""
def maxProfit(self, prices):
low = sys.maxint
result = 0
for price in prices:
if low > price:
low = price
result = max(result, price - low)
return resultLast updated