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 |
Tags
- 가장 가까운 단어
- port
- IO bound
- TCP/IP
- 프로그래머스
- process
- 2차원 배열 출력
- 코딩테스트
- stack
- 십진수 이진수 전환
- deque
- Split
- green thread
- CPU
- URL
- CPU bound
- Queue
- 동시성문제
- reflection
- DICTIONARY
- frontPattern
- dns
- java
- http
- Spring
- 문자열
- 크기가 작은 부분 문자열
- annotation
- 문자열 내마음대로 정렬하기
- springMVC
Archives
- Today
- Total
아무나개발하자
[1차] 비밀지도 본문
문제
https://school.programmers.co.kr/learn/courses/30/lessons/17681
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
풀이
def getBinaryNum(n, num):
lists = []
while True:
remainder = num % 2
num = num // 2
lists.append(remainder)
if num < 2:
lists.append(num)
break
if len(lists) < n:
add = n - len(lists)
for i in range(add):
lists.append(0)
lists.reverse()
return lists
def solution(n, arr1, arr2):
answer = []
maps1 = []
maps2 = []
for elem1, elem2 in zip(arr1, arr2):
maps1.append(getBinaryNum(n, elem1))
maps2.append(getBinaryNum(n, elem2))
for map1, map2 in zip(maps1, maps2):
add_list = []
for elem1, elem2 in zip(map1, map2):
if (elem1 == 1 or elem2 == 1):
add_list.append("#")
elif(elem1 == 0 and elem2 == 0):
add_list.append(" ")
_add = "".join(add_list)
answer.append(_add)
return answer
'코딩테스트' 카테고리의 다른 글
문자열 내 마음대로 정렬하기 (0) | 2023.01.26 |
---|---|
가장 가까운 같은 글자 (0) | 2023.01.13 |
이상한 문자 만들기 (0) | 2023.01.10 |
시저 암호 (0) | 2023.01.09 |
다음 큰 숫자 (0) | 2023.01.08 |