Last active
October 3, 2018 12:53
-
-
Save junho85/afa0cba6b879caba91cef5be0092ee20 to your computer and use it in GitHub Desktop.
PS - 비밀지도 - 2018 KAKAO BLIND RECRUITMENT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python3 | |
def solution(n, arr1, arr2): | |
answer = [] | |
for idx in range(n): | |
result_arr = arr1[idx] | arr2[idx] | |
# answer.append(bin(result_arr)[2:].zfill(n).replace('1', '#').replace('0', ' ')) | |
answer.append(format(result_arr, 'b').zfill(n).replace('1', '#').replace('0', ' ')) | |
return answer | |
# test | |
# print(solution(5, [9, 20, 28, 18, 11], [30, 1, 21, 17, 28])) | |
print(solution(6, [46, 33, 33 ,22, 31, 50], [27 ,56, 19, 14, 14, 10])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
숫자를 2진수 문제열로 바꾸는 두가지 방법