Skip to content

Commit 24ae00d

Browse files
committed
Runtime: 131 ms (Top 48.09%) | Memory: 46.3 MB (Top 65.46%)
1 parent f13bfea commit 24ae00d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
+6-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1+
// Runtime: 131 ms (Top 48.09%) | Memory: 46.3 MB (Top 65.46%)
12

23
var canJump = function(nums) {
34
let target = nums.length-1;
45
let max = 0,index = 0;
5-
6+
67
while(index <= target){
78
max = Math.max(max,index + nums[index]);
8-
9+
910
if(max >= target) return true;
10-
11+
1112
if(index >= max && nums[index] === 0) return false;
12-
13+
1314
index++;
1415
}
15-
16+
1617
return false;
1718
};

0 commit comments

Comments
 (0)