반응형
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 |
Tags
- BFS
- socket
- 프로그래머스 레벨 2
- Node.js
- 그래프
- javascript
- Algorithm
- TCP
- typescript
- type challenge
- 프로그래머스
- dp
- 수학
- 타입 챌린지
- 자바스크립트
- 크롤링
- HTTP 완벽 가이드
- 백준
- ip
- 알고리즘
- 문자열
- 레벨 1
- 타입스크립트
- dfs
- 가천대
- Nestjs
- 쉬운 문제
- Crawling
- 소켓
- HTTP
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 |