-
[못품/leetcode/javascript] 121.Best Time to Buy and Sell stock카테고리 없음 2023. 3. 27. 07:39
var maxProfit = function(prices) { let min = prices[0]; let profit = 0; for(let i=0;i<prices.length;i++){ min = Math.min(min,prices[i]); profit = Math.max(profit,prices[i]-min) } return profit };