[LeetCode] 121. Best Time to Buy and Sell Stock
Python
class Solution:
def maxProfit(self, prices: List[int]) -> int:
answer = 0
num = sys.maxsize
for price in prices:
num = min(price, num)
answer = max(answer, price - num)
return answer
댓글남기기