본문 바로가기
CodeSignal/Arcade

CodeSignal [29/60] chessBoardCellColor

by 벤진[Benzene] 2020. 5. 20.

문제: Given two cells on the standard chess board, determine whether they have the same color or not.

 

Example:

  • For cell1 = "A1" and cell2 = "C3", the output should be
    chessBoardCellColor(cell1, cell2) = true.

  • For cell1 = "A1" and cell2 = "H3", the output should be
    chessBoardCellColor(cell1, cell2) = false.

     

 

-문제해결 정리-

1. Cell 1 과 Cell 2가 색이 같아질 모든 True 값에 대하여 비교하고, 참이면 Return 아닐경우에는 False Return

(Brute Force solution)

 

나는 Cell 하나하나 비교하여 Brute force의 방법으로 풀었는데, Solution을 보니 Ord 함수로 너무 쉽게 구현되어 있어 오늘도 문제를 풀고 새로운걸 배운다.  

 

 

모든 문제에 대한 저작권은 CodeSignal 회사에 있습니다. [Copyright © 2020 BrainFights Inc. All rights reserved]

https://codesignal.com/

'CodeSignal > Arcade' 카테고리의 다른 글

CodeSignal [31/60] depositProfit  (0) 2020.05.22
CodeSignal [30/60] circleOfNumbers  (0) 2020.05.21
CodeSignal [28/60] alphabeticShift  (0) 2020.05.19
CodeSignal [27/60] variableName  (0) 2020.05.18
CodeSignal [26/60] evenDigitsOnly  (0) 2020.05.17

댓글