function solution(n, arr1, arr2) {
var answer = [];
for (var i = 0; i < n; i++){
answer.push((arr1[i] | arr2[i]).toString(2));
}
answer = [...answer].map(item => {
if (item.length < n){
while (item.length !== n)
{
item = '0' + item;
}
}
reg0 = new RegExp(/0/,'g');
reg1 = new RegExp(/1/,'g');
item = item.replace(reg0,' ');
item = item.replace(reg1,'#');
return item;
});
return answer;
}
'๐ฏ CodingTest > Programmers' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Programmers] (Javascript) ์คํ์ฑํ ๋ฐฉ (0) | 2022.04.21 |
---|---|
[Programmers] (Javascript) ๋ฌธ์์ด ์์ถ (0) | 2022.04.21 |
[Programmers] (Javascript) ์คํจ์จ (0) | 2022.04.21 |
[Programmers] (Javascript) ํฌ๋ ์ธ ์ธํ๋ฝ๊ธฐ (0) | 2022.04.21 |
[Programmers] (Javascript) ํคํจ๋ ๋๋ฅด๊ธฐ (0) | 2022.04.21 |