Skip to content

Commit 24f627d

Browse files
authored
jump game solution
1 parent d277c68 commit 24f627d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

jump-game/yhkee0404.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
bool canJump(List<int> nums) {
3+
for (int i = 0, j = 0; j < nums.length - 1; i++) {
4+
if (j < i) {
5+
return false;
6+
}
7+
j = max(i + nums[i], j);
8+
}
9+
return true;
10+
}
11+
}

0 commit comments

Comments
 (0)