package main func main() { } func canJump(nums []int) bool { maxstep := 0 for i := 0; i < len(nums); i++ { if maxstep == 0 { maxstep = nums[i] + (i + 1) continue } if (i + 1) <= maxstep { tmp := nums[i] + (i + 1) if tmp > maxstep { maxstep = tmp } } else { return false } } return true }