diff --git "a/leetcode3/\354\265\234\353\257\274\354\247\200/121.py" "b/leetcode3/\354\265\234\353\257\274\354\247\200/121.py" new file mode 100644 index 00000000..45b0ef7f --- /dev/null +++ "b/leetcode3/\354\265\234\353\257\274\354\247\200/121.py" @@ -0,0 +1,11 @@ +class Solution: + def maxProfit(self, prices: List[int]) -> int: + min_price = prices[0] + max_profit = 0 + for price in prices: + if price < min_price: + min_price = price + elif price - min_price > max_profit: + max_profit = price - min_price + return max_profit + \ No newline at end of file