반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- HTTP
- dp
- dfs
- HTTP 완벽 가이드
- 문자열
- Nestjs
- 소켓
- 레벨 1
- Algorithm
- 타입 챌린지
- 가천대
- 수학
- Node.js
- 쉬운 문제
- 크롤링
- typescript
- TCP
- 백준
- 자바스크립트
- BFS
- 그래프
- Crawling
- ip
- 알고리즘
- 타입스크립트
- javascript
- 프로그래머스 레벨 2
- 프로그래머스
- socket
- type challenge
Archives
- Today
- Total
kakasoo
[node.js] [1차]비밀지도 ( 프로그래머스 레벨1 ) 본문
반응형
// // 프로그래머스 레벨 1 2019 KAKAO BLIND RECRUITMENT > [1차]비밀지도를 풀었습니다.
const numPad = (n, number) => {
while (String(number).length < n) {
number = "0" + number;
}
return number;
};
function solution(n, arr1, arr2) {
var answer = [];
arr1 = arr1.map((el) => numPad(n, el.toString(2)));
arr2 = arr2.map((el) => numPad(n, el.toString(2)));
for (let i = 0; i < arr1.length; i++) {
let row = "";
for (let j = 0; j < arr1[0].length; j++) {
if (arr1[i][j] == 1 || arr2[i][j] == 1) {
row += "#";
} else row += " ";
}
answer.push(row);
}
return answer;
}
반응형
'프로그래밍 > 알고리즘 풀이' 카테고리의 다른 글
[node.js] 스킬트리 ( 프로그래머스 레벨2 ) (0) | 2021.06.28 |
---|---|
[node.js] [1차]다트 게임 ( 프로그래머스 레벨1 ) (0) | 2021.06.28 |
[node.js] 실패율 ( 프로그래머스 레벨 1 ) (0) | 2021.06.28 |
[node.js] 예산 ( 프로그래머스 레벨1 ) (0) | 2021.06.28 |
[node.js] 직사각형 별찍기 ( 프로그래머스 레벨1 ) (0) | 2021.06.28 |