Problem :

https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/


My Solution :

class Solution:
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
profit = 0
low = float('inf')
for p in prices:
profit = max(profit, p - low)
low = min(low, p)
return profit