class Solution:
def maxProfit(self, prices: List[int]) -> int:
minSoFar = prices[0]
maxProfitSoFar = 0
for price in prices:
if minSoFar > price:
minSoFar = price
continue
if maxProfitSoFar < price - minSoFar:
maxProfitSoFar = price - minSoFar
return maxProfitSoFar