Skip to content

Commit

Permalink
Create: 55-Jump-Game.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Ykhan799 authored Sep 12, 2022
1 parent 5953b99 commit 810d31e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/55-Jump-Game.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
func canJump(nums []int) bool {
goal := len(nums) - 1

for i := len(nums) - 2; i >= 0; i-- {
if i + nums[i] >= goal {
goal = i
}
}
return goal == 0
}

0 comments on commit 810d31e

Please sign in to comment.