Skip to content

Commit e67a6bf

Browse files
committed
added Function
1 parent 98ab6e2 commit e67a6bf

File tree

1 file changed

+3
-3
lines changed
  • Best Time to Buy and Sell Stock

1 file changed

+3
-3
lines changed

Best Time to Buy and Sell Stock/code.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
var maxProfit = function (price) {
77
let max = 0;
88
let min = Infinity;
9-
for (let i = 0; i < price.length; i){
9+
for (let i = 0; i < price.length; i) {
1010
min = Math.min(mis, price[i]);
11-
max = Math.max(max,price[i]-min)
11+
max = Math.max(max, price[i] - min)
1212

1313
}
1414
return max;
1515

16-
}
16+
};

0 commit comments

Comments
 (0)