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