Skip to content

Commit 8574b9c

Browse files
committed
Runtime: 2 ms (Top 82.01%) | Memory: 50 MB (Top 21.41%)
1 parent e76ad95 commit 8574b9c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1+
// Runtime: 2 ms (Top 82.01%) | Memory: 50 MB (Top 21.41%)
12
class Solution {
2-
3+
34
public int jump(int[] nums) {
4-
5+
56
int result = 0;
6-
7+
78
int L = 0;
89
int R = 0;
9-
10+
1011
while (R < nums.length - 1) {
11-
12+
1213
int localMaxRight = 0;
13-
14+
1415
for (int i=L; i<=R; i++) {
15-
16+
1617
localMaxRight = Math.max(i + nums[i], localMaxRight);
1718
}
18-
19+
1920
L = R + 1;
2021
R = localMaxRight;
21-
result++;
22+
result++;
2223
}
23-
24+
2425
return result;
2526
}
26-
}
27+
}

0 commit comments

Comments
 (0)