def jumpingOnClouds(c):
# Write your code here
current = 0
needed_jump = 0
while current < len(c):
p = current + 1
pp = current + 2
if pp < len(c) and c[pp] != 1:
current = pp
elif p < len(c) and c[p] != 1:
current = p
else:
break
needed_jump += 1
return needed_jump
'# 코딩 문제 관련 > 파이썬' 카테고리의 다른 글
[HackerRank-python] Queen's Attack Ⅱ (0) | 2022.08.29 |
---|---|
[HackerRank-python] Equalize the Array (0) | 2022.08.24 |
[HackerRank-python] Repeated String (0) | 2022.08.22 |
[HackerRank-python] Non-Divisible Subset (0) | 2022.08.14 |
[HackerRank-python] Cut the sticks (0) | 2022.08.11 |