Skip to content

Commit

Permalink
Merge pull request #505 from Mirim-Study/JiaLee0707-patch-7
Browse files Browse the repository at this point in the history
level01.비밀지도
  • Loading branch information
JiaLee0707 authored Oct 8, 2022
2 parents d41b9ba + f1f378e commit 37d1e33
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function solution(n, arr1, arr2) {
var answer = [];

arr1 = arr1.map((value) => value.toString(2));
arr2 = arr2.map((value) => value.toString(2));

for(let i=0; i<n; i++) {
answer[i] = '';
const value1 = arr1[i].padStart(n, '0');
const value2 = arr2[i].padStart(n, '0');

for(let j=0; j<n; j++) {
if(value1[j] === '1' || value2[j] === '1') answer[i] += '#';
else answer[i] += ' ';
}
}
return answer;
}

0 comments on commit 37d1e33

Please sign in to comment.