class Solution:
def maxProfit(self, prices: List[int]) -> int:
if len(prices) == 0: return 0
maxPro, minPrice = 0, prices[0]
for i in range(1,len(prices)):
if prices[i] <= minPrice: minPrice = prices[i]
else: maxPro = max(maxPro, prices[i]-minPrice)
return maxPro