We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4c8e808 commit 7875891Copy full SHA for 7875891
solution/122.Best Time to Buy and Sell Stock II/Solution.js
@@ -0,0 +1,9 @@
1
+const maxProfit2 = function(prices){
2
+ let profit = 0;
3
+ for(let i = 1; i < prices.length; i++){
4
+ if(prices[i]-prices[i-1] > 0){
5
+ profit+=prices[i]-prices[i-1];
6
+ }
7
8
+ return profit;
9
+}
0 commit comments