Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1f174b3

Browse files
authoredApr 25, 2020
Create Jump Game
1 parent 4989e70 commit 1f174b3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎Jump Game

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 end = 0;
4+
5+
for(int i = 0; i<=end; i++){
6+
if(end >= nums.length-1){
7+
return true;
8+
}
9+
if(i+nums[i]>end){
10+
end = i+nums[i];
11+
}
12+
}
13+
return false;
14+
}
15+
}

0 commit comments

Comments
 (0)
Please sign in to comment.