We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 340e1d1 commit 6b9bb1eCopy full SHA for 6b9bb1e
jump-game/sora0319.java
@@ -0,0 +1,10 @@
1
+public class Solution {
2
+ public boolean canJump(int[] nums) {
3
+ int longLength = 0;
4
+ for (int i = 0; i < nums.length; i++) {
5
+ if (i > longLength) return false;
6
+ longLength = Math.max(longLength, i + nums[i]);
7
+ }
8
+ return true;
9
10
+}
0 commit comments