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

// 프로그래머스 레벨 1 3진법 뒤집기를 풀었습니다. const solution = (n) => parseInt(n.toString(3).split("").reverse().join(""), 3);

// 프로그래머스 level1 예산을 풀었습니다. function solution(d, budget) { d = d.sort((a, b) => a - b); const DP = new Array(d.length).fill(0); if (budget - d[0] >= 0) { DP[0] = 1; budget -= d[0]; } for (let i = 1; i = 0) { DP[i] = Math.max(DP[i - 1] + 1, DP[i]); budget -= d[i]; } } return Math.max(...DP); }

// 프로그래머스 레벨1 소수 만들기를 풀었습니다. const solution = (nums) => { const answer = []; const visited = Array(nums.length).fill(false); let count = 0; const sumOfVisited = () => { let sum = 0; for (let i = 0; i { if (visited.filter((el) => el).length === 3) { answer.push(sumOfVisited()); return;..

// 프로그래머스 레벨1 직사각형 별찍기를 풀었습니다. process.stdin.setEncoding("utf8"); process.stdin.on("data", (data) => { const n = data.split(" "); const a = Number(n[0]), b = Number(n[1]); for (let i = 0; i < b; i++) { for (let j = 0; j < a; j++) { process.stdout.write("*"); } console.log(); } }); 다 더해주기만 하면 되는 간단한 문제.

// 프로그래머스 레벨1 x만큼 간격이 있는 n개의 숫자를 풀었습니다. function solution(x, n) { let arr = [x]; let temp = x; for (let i = 0; i < n - 1; i++) { temp += x; arr.push(temp); } return arr; } 다 더해주기만 하면 되는 간단한 문제.

// 프로그래머스 레벨1 행렬의 덧셈을 풀었습니다. function solution(arr1, arr2) { return arr1.map((el, i) => el.map((n, j) => (n += arr2[i][j]))); } 다 더해주기만 하면 되는 간단한 문제.

// 프로그래머스 레벨1 핸드폰 번호 가리기를 풀었습니다. function solution(phone_number) { let a, b, c, d, e; let arr = ([a, b, c, d, ...e] = phone_number.split("").reverse()); return [e.map((el) => "*").join(""), d, c, b, a].join(""); } 구조분해할당과 나머지 연산자를 이용하면 쉽게 가능해진다.

// 프로그래머스 level1 약수의 합을 풀었습니다. function solution(n) { var answer = 0; for (let i = 1; i

// 프로그래머스 level1 k번째 수 const solution = (array, commands) => new Array(commands.length).fill(0).map((el, i) => i + 1).map(el => array.slice(commands[el-1][0] - 1, commands[el-1][1]).sort((o1, o2) => o1 - o2)[commands[el-1][2] -1]); 이 때 내가 왜 이렇게 풀었는지 기억이 나지 않는다. 그냥 함수형 컨셉을 해보고 싶었던 모양이다. 당연히 저런 가독성 없는 코드를 평소에도 짜는 건 아니다. const solution = (array, commands) => { const answer = []; commands.forEach((l..