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

Commit 22b77d6

Browse files
0055 修改代码初始覆盖范围的值和注释
0055 修改代码初始覆盖范围的值和注释
1 parent 1244f1d commit 22b77d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎problems/0055.跳跃游戏.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ class Solution {
9292
if (nums.length == 1) {
9393
return true;
9494
}
95-
//覆盖范围
96-
int coverRange = nums[0];
95+
//覆盖范围, 初始覆盖范围应该是0,因为下面的迭代是从下标0开始的
96+
int coverRange = 0;
9797
//在覆盖范围内更新最大的覆盖范围
9898
for (int i = 0; i <= coverRange; i++) {
9999
coverRange = Math.max(coverRange, i + nums[i]);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /