class Solution:
def maxProfit(self, prices: List[int]) -> int:
minPrice = float(inf)
profit = 0
maxProfit = 0
for i in range(len(prices)):
minPrice = min(minPrice, prices[i])
maxProfit = max(maxProfit, prices[i] - minPrice)
return maxProfit
https://leetcode.com/problems/best-time-to-buy-and-sell-stock/