You are viewing a single comment's thread. Return to all comments →
Hi this is my solution :) def jumpingOnClouds(c): # Write your code here index = 0 jumps = 1
while index < len(c) - 3: if c[index + 2] == 0: index = index + 2 jumps = jumps + 1 else: index = index + 1 jumps = jumps + 1 return jumps
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')
n = int(input().strip()) c = list(map(int, input().rstrip().split())) result = jumpingOnClouds(c) fptr.write(str(result) + '\n') fptr.close()
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 →
Hi this is my solution :) def jumpingOnClouds(c): # Write your code here index = 0 jumps = 1
while index < len(c) - 3: if c[index + 2] == 0: index = index + 2 jumps = jumps + 1 else: index = index + 1 jumps = jumps + 1 return jumps
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')