Skip to content

Commit acdd81f

Browse files
committed
Add jump-game Solution - s0ooo0k
1 parent d861e7d commit acdd81f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

jump-game/s0ooo0k.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public boolean canJump(int[] nums) {
3+
int n = nums.length;
4+
int maxJump=0;
5+
for(int i=0; i<n; i++) {
6+
if(i>maxJump) return false;
7+
else {
8+
maxJump = Math.max(maxJump, i+nums[i]);
9+
}
10+
11+
}
12+
return true;
13+
}
14+
}
15+

0 commit comments

Comments
 (0)