Skip to content

Commit 06ae7fd

Browse files
author
mykoo
committed
best-time-to-buy-and-sell-stock
1 parent 57b8fab commit 06ae7fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

best-time-to-buy-and-sell-stock/GUMUNYEONG.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
var maxProfit = function (prices) {
66
let max = 0;
77

8-
for (let i = 1; i <= prices.length; i++) {
8+
for (let i = 0; i <= prices.length; i++) {
99
for (let j = i + 1; j <= prices.length; j++) {
1010
const profit = prices[j] - prices[i];
1111
max = profit > max ? profit : max;

0 commit comments

Comments
 (0)