class Solution:
def maxProfit(self, prices: List[int]) -> int:
m = 10001
ans = 0
for price in prices:
ans = max(ans, price - m)
m = min(price, m)
return ans
easy 나오면 일단 안심하고 보는 버릇이 생겼음
class Solution:
def maxProfit(self, prices: List[int]) -> int:
m = 10001
ans = 0
for price in prices:
ans = max(ans, price - m)
m = min(price, m)
return ans
easy 나오면 일단 안심하고 보는 버릇이 생겼음
댓글 0