We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
n = len(c)
i = 0
jump = 0
if n == 2:
return 1
while i < n-2:
if c[i+2] == 0:
i = i+2
jump += 1
else:
i = i+1
jump += 1
if c[-2] == 0 and c[-3] !=0:
return jump + 1
else:
return jump
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Jumping on the Clouds
You are viewing a single comment's thread. Return to all comments →
def jumpingOnClouds(c):