diff --git a/sixth day/Best Time to Buy and Sell Stock II.md b/sixth day/Best Time to Buy and Sell Stock II.md index 167a8ac..6fa5e73 100644 --- a/sixth day/Best Time to Buy and Sell Stock II.md +++ b/sixth day/Best Time to Buy and Sell Stock II.md @@ -41,11 +41,9 @@ var maxProfit = function(prices) { for(let i = 0; i < prices.length; i++){ if(prices[i] > stock){ sum += prices[i] - stock; - stock = prices[i]; - }else{ - stock = prices[i]; } + stock = prices[i]; } return sum; }; -``` \ No newline at end of file +```