Created
September 16, 2017 06:50
-
-
Save rosd89/4acaab8923573257d945999f70313caa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lenCheck = (n, str) => str.length < n ? '0'.repeat(n - str.length) + str : str; | |
function solution(n, arr1, arr2) { | |
const answer = []; | |
for(let i=0; i<arr1.length; i++) { | |
const n1 = lenCheck(n, (+arr1[i]).toString(2)); | |
const n2 = lenCheck(n, (+arr2[i]).toString(2)); | |
const l = []; | |
for(let j=0; j < n; j++) { | |
l.push(n1[j] === '1' || n2[j] === '1' ? '#' : ' '); | |
} | |
answer[i] = l.join(''); | |
} | |
return answer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment