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 57b8fab commit 06ae7fdCopy full SHA for 06ae7fd
best-time-to-buy-and-sell-stock/GUMUNYEONG.js
@@ -5,7 +5,7 @@
5
var maxProfit = function (prices) {
6
let max = 0;
7
8
- for (let i = 1; i <= prices.length; i++) {
+ for (let i = 0; i <= prices.length; i++) {
9
for (let j = i + 1; j <= prices.length; j++) {
10
const profit = prices[j] - prices[i];
11
max = profit > max ? profit : max;
0 commit comments