We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ce5e47 commit 72a46d1Copy full SHA for 72a46d1
1 file changed
best-time-to-buy-and-sell-stock/Cyjin-jani.js
@@ -22,6 +22,7 @@ const maxProfit_naive = function (prices) {
22
const maxProfit = function (prices) {
23
let buyIdx = 0;
24
let sellIdx = 1;
25
+ let profit = 0;
26
27
while (sellIdx < prices.length) {
28
let buyPrice = prices[buyIdx];
0 commit comments