Skip to content

Commit 810d31e

Browse files
authored
Create: 55-Jump-Game.go
1 parent 5953b99 commit 810d31e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

go/55-Jump-Game.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
func canJump(nums []int) bool {
2+
goal := len(nums) - 1
3+
4+
for i := len(nums) - 2; i >= 0; i-- {
5+
if i + nums[i] >= goal {
6+
goal = i
7+
}
8+
}
9+
return goal == 0
10+
}

0 commit comments

Comments
 (0)