2 parents 2a96f89 + e1bff7b commit c3887f2Copy full SHA for c3887f2
1 file changed
leetcode3/최민지/121.py
@@ -0,0 +1,11 @@
1
+class Solution:
2
+ def maxProfit(self, prices: List[int]) -> int:
3
+ min_price = prices[0]
4
+ max_profit = 0
5
+ for price in prices:
6
+ if price < min_price:
7
+ min_price = price
8
+ elif price - min_price > max_profit:
9
+ max_profit = price - min_price
10
+ return max_profit
11
+
0 commit comments