시간 복잡도 : O(n)
class Solution(object):
def maxProfit(self, prices):
profit = 0
buy = prices[0]
for sell in prices[1:]:
if sell > buy:
profit = max(profit, sell - buy)
else:
buy = sell
return profit