문제: Check if all digits of the given integer are even.
Examples:
- For n = 248622, the output should be
evenDigitsOnly(n) = true; - For n = 642386, the output should be
evenDigitsOnly(n) = false.
-문제 해결 정리-
1. 받는 input 'n' 인자를 string 으로 바꿔서 iterable 할수 있게 만들어 준다.
2. String 으로 바뀌어진 n 인자를 for loop 을 써서 2로 나누어 even 인지 odd 인지 확인해 준다.
3. 만약에 한 숫자라도 even 이 아닌 케이스 발견시, 바로 False 값으로 return. 모든 숫자가 even 일 경우에는 True 값 return.
모든 문제에 대한 저작권은 CodeSignal 회사에 있습니다. [Copyright © 2020 BrainFights Inc. All rights reserved]
'CodeSignal > Arcade' 카테고리의 다른 글
CodeSignal [30/60] circleOfNumbers (0) | 2020.05.21 |
---|---|
CodeSignal [29/60] chessBoardCellColor (0) | 2020.05.20 |
CodeSignal [28/60] alphabeticShift (0) | 2020.05.19 |
CodeSignal [27/60] variableName (0) | 2020.05.18 |
CodeSignal [25/60] Array Replace (0) | 2020.05.16 |
댓글