We will stop only if the jump length from the current position is zero and the current position is the furthest we can jump from any preceding position.
func canJump(_ nums: [Int]) -> Bool {
if nums.isEmpty {
return false
}
var maxReach = 0
for i in 0..<nums.count - 1 {
if maxReach < nums[i] + i {
maxReach = nums[i] + i
}
if nums[i] == 0 && maxReach == i {
return false;
}
}
return true
}