https://programmers.co.kr/learn/courses/30/lessons/17681
Code
1
2
3
4
5
6
7
8
9
10
11
def solution(n, arr1, arr2):
def dec2bin(d):
s = f"{bin(d)[2:]:>0{n}}"
return [int(e) for e in s]
rst = []
for r1, r2 in zip(arr1, arr2):
r = [str(r1c | r2c) for r1c, r2c in zip(dec2bin(r1), dec2bin(r2))]
s = ''.join(r).replace('0', ' ').replace('1', '#')
rst.append(s)
return rst
Complexity
$O(n^3)$
PREVIOUSEtc