Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- R
- 혼자 공부하는 C언어
- 윤성우 열혈자료구조
- Serialization
- JSON
- 메모리구조
- coding test
- Graph
- Stack
- Algorithm
- buffer
- 알기쉬운 알고리즘
- insertion sort
- 이것이 자바다
- list 컬렉션
- datastructure
- C programming
- s
- 윤성우의 열혈 자료구조
- 이스케이프 문자
- C 언어 코딩 도장
- stream
- Selection Sorting
Archives
- Today
- Total
Engineering Note
비밀지도 본문
it 취업을 위한 알고리즘 문제 풀이
문제
코드
def tenTobinary(number):
binary = []
temp = number
while temp:
binary.insert(0, temp % 2)
temp //= 2
res = "".join(map(str,binary))
return res
def solution(n, arr1, arr2):
answer = []
for i in range(len(arr1)):
binary1 = tenTobinary(arr1[i])
binary2 = tenTobinary(arr2[i])
while len(binary1) < n :
binary1 = "0" + binary1
while len(binary2) < n :
binary2 = "0" + binary2
secretMap = ""
for j in range(n):
if binary1[j] == "0" and binary2[j] == "0":
secretMap += " "
else:
secretMap += "#"
else:
answer.append(secretMap)
return answer
문제해결방법
'Problem Solving > Programmers' 카테고리의 다른 글
[Programmers] 모의고사 (0) | 2021.11.02 |
---|---|
스킬 체크 테스트 Level.1 (0) | 2021.07.17 |
네트워크 (0) | 2021.06.27 |
단어변환 (0) | 2021.06.27 |
타겟넘버 (0) | 2021.06.15 |
Comments