def canJUMP(a):
n = len(a)
f = True
sm= a[0]
ind = a[1]
indexof = 1
while True:
sm+=ind
if sm>=n:
break
if ind ==0:
f = False
break
ind = a[indexof+ind]
indexof = indexof+ind
if f:print(1)
else:print(0)
What is the problem with this approach ?