728x90
반응형
문제)
www.codewars.com/kata/552c028c030765286c00007d/train/python
내가 푼 답)
def iq_test(numbers):
remain = [ int(num)%2 for num in numbers.split(' ')]
for i in range(len(remain) - 2):
if (remain[i] != remain[i+1]):
if (remain[i] == remain[i+2]):
return i+2
elif (remain[i+1] == remain[i+2]):
return i+1
return len(remain)
테스트 결과)
마음에 드는 남이 푼 답)
728x90
반응형
'Algorithm > codewars' 카테고리의 다른 글
Human readable duration format 답안 (0) | 2021.04.01 |
---|---|
Take a Ten Minute Walk 답안 (0) | 2021.04.01 |
Credit Card Mask 답안 (0) | 2021.04.01 |
Format a string of names like 'Bart, Lisa & Maggie'. 답안 (0) | 2021.04.01 |
Catching Car Mileage Numbers 답안 (0) | 2021.04.01 |