Skip to content

Commit 9010116

Browse files
committed
add 55
1 parent 816957d commit 9010116

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

medium/55-jump-game.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const canJump = (nums) => {
2+
let last = nums.length - 1;
3+
for (let i = nums.length - 2; i >= 0; i--) {
4+
if (i + nums[i] >= last) {
5+
last = i;
6+
}
7+
}
8+
return last === 0;
9+
}

0 commit comments

Comments
 (0)