[문제]

[풀이]
def solution(n, arr1, arr2):
answer = []
for i in range(n):
mapped = bin(arr1[i]|arr2[i])[2:].zfill(n)
matched = mapped.replace("1", "#").replace("0", " ")
answer.append(matched)
return answer
- zfill(n): 앞에 0을 붙여서 문자열 길이를 n으로 맞춰주는 메서드
[링크]
https://school.programmers.co.kr/learn/courses/30/lessons/17681
프로그래머스
SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
'CodingTest > Programmers' 카테고리의 다른 글
| [프로그래머스 Lv1] 추억 점수(python, 해시) (1) | 2025.08.07 |
|---|---|
| [프로그래머스 Lv1] 카드 뭉치(python, 구현) (0) | 2025.08.07 |
| [프로그래머스 Lv1] 폰켓몬(python, 해시) (0) | 2025.08.07 |
| [프로그래머스 Lv1] 기사단원의 무기(python, 구현) (0) | 2025.08.07 |
| [프로그래머스 Lv1] 모의고사(python, 완전탐색) (0) | 2025.08.07 |
