We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e76ad95 commit 8574b9cCopy full SHA for 8574b9c
scripts/algorithms/J/Jump Game II/Jump Game II.java
@@ -1,26 +1,27 @@
1
+// Runtime: 2 ms (Top 82.01%) | Memory: 50 MB (Top 21.41%)
2
class Solution {
-
3
+
4
public int jump(int[] nums) {
5
6
int result = 0;
7
8
int L = 0;
9
int R = 0;
10
11
while (R < nums.length - 1) {
12
13
int localMaxRight = 0;
14
15
for (int i=L; i<=R; i++) {
16
17
localMaxRight = Math.max(i + nums[i], localMaxRight);
18
}
19
20
L = R + 1;
21
R = localMaxRight;
- result++;
22
+ result++;
23
24
25
return result;
26
-}
27
+}
0 commit comments