[자바스크립트로 구현한 알고리즘] IQ Test

남양주개발자

·

2016. 9. 21. 14:52

728x90
반응형



Bob is preparing to pass IQ test. The most frequent task in this test is to find out which one of the given numbers differs from the others. Bob observed that one number usually differs from the others in evenness. Help Bob — to check his answers, he needs a program that among the given numbers finds one that is different in evenness, and return a position of this number. 


! Keep in mind that your task is to help Bob solve a real IQ test, which means indexes of the elements start from 1 (not 0) 


Examples : 


iqTest("2 4 7 8 10") => 3 // Third number is odd, while the rest of the numbers are even 


iqTest("1 2 1 1") => 2 // Second number is even, while the rest of the numbers are odd




728x90
반응형
그리드형

이 포스팅은 쿠팡파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.

💖 저자에게 암호화폐로 후원하기 💖

아이콘을 클릭하면 지갑 주소가자동으로 복사됩니다