Skip to content

Commit 72a46d1

Browse files
committed
add: 누락된 변수 추가
1 parent 7ce5e47 commit 72a46d1

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

best-time-to-buy-and-sell-stock/Cyjin-jani.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const maxProfit_naive = function (prices) {
2222
const maxProfit = function (prices) {
2323
let buyIdx = 0;
2424
let sellIdx = 1;
25+
let profit = 0;
2526

2627
while (sellIdx < prices.length) {
2728
let buyPrice = prices[buyIdx];

0 commit comments

Comments
 (0)