From 79fdd530fe6f0bd923754df1bab3a5e75ad87b1b Mon Sep 17 00:00:00 2001 From: Edwin George Saju Date: Wed, 11 Jul 2018 12:06:38 +0100 Subject: [PATCH] Update Best Time to Buy and Sell Stock II.md You don't need else condition --- sixth day/Best Time to Buy and Sell Stock II.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 +```