Skip to content

Commit 7498c5c

Browse files
committed
[LEET] 55 Jump Game (Medium)
1 parent 16d18cf commit 7498c5c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

이용훈/10주차/260303.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {boolean}
4+
*/
5+
var canJump = function(nums) {
6+
let max = 0;
7+
8+
for(let i = 0; i < nums.length; i++) {
9+
if(i > max) return false;
10+
11+
max = Math.max(max, i + nums[i]);
12+
}
13+
14+
return true;
15+
};

0 commit comments

Comments
 (0)