Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitafe9a4e

Browse files
authored
Merge pull requestneetcode-gh#3084 from iml0kesh/patch-2
Update 0121-best-time-to-buy-and-sell-stock.java
2 parentsdd2dd5b +ad1983b commitafe9a4e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

‎java/0121-best-time-to-buy-and-sell-stock.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ public int maxProfit(int[] prices) {
77
while (right <prices.length) {
88
if (prices[left] <prices[right]) {
99
maxProfit =Math.max(maxProfit,prices[right] -prices[left]);
10-
right++;
1110
}else {
1211
left =right;
13-
right++;
1412
}
13+
right++;
1514
}
1615
returnmaxProfit;
1716
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp