일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Crawling
- BFS
- 백준
- 소켓
- HTTP
- 알고리즘
- socket
- 그래프
- 수학
- HTTP 완벽 가이드
- Nestjs
- Node.js
- 타입 챌린지
- 타입스크립트
- 가천대
- ip
- 크롤링
- dfs
- type challenge
- 프로그래머스 레벨 2
- 프로그래머스
- Algorithm
- 쉬운 문제
- typescript
- 자바스크립트
- 문자열
- dp
- javascript
- TCP
- 레벨 1
- Today
- Total
목록javascript (104)
kakasoo
// 프로그래머스 레벨2 행렬 테두리 회전하기를 풀었습니다. const rotateMap = (map, query) => { const [row1, col1, row2, col2] = query.map((el) => el - 1); const answer = []; for (let i = col1; i col1; i--) answer.push(map[row2][i]); for (let i = row2; i > row1; i--) answer.push(map[i][col1]); answe..
/** * 1. 단품 메뉴들의 합집합을 만든다. * 2. 단품 메뉴들의 조합을 만든다. ( 중복은 제거하고, length가 2 이상. ) * 3. 조합들과 손님의 주문을 각각 비교하여 횟수를 구한다. * 4. 각 팔린 횟수 중에서 가장 메뉴 가짓수length가 큰 것을 뽑는다. */ const sortString = (str) => str.sort((a, b) => { const aStr = a.split(""); const bStr = b.split(""); while (aStr.length && bStr.length) { const aCode = aStr.shift().charCodeAt(); const bCode = bStr.shift().charCodeAt(); if (aCode === bCode..
// 프로그래머스 레벨2 [1차] 뉴스 클러스터링을 풀었습니다. // const lastOnlyAlphabet = (str) => { // const aCode = 'A'.charCodeAt(); // const zCode = 'Z'.charCodeAt(); // return str.toUpperCase().split('').filter((el) => { // const cur = el.charCodeAt(); // if (aCode
// 프로그래머스 레벨2 배달을 풀었습니다. const makeMap = (N, road) => { const map = new Array(N).fill(false); for (let i = 0; i value) { map[from - 1][to - 1] = value; map[to - 1][from - 1] = value; } } return map; }; const solution = (N..
// 프로그래머스 레벨2 예상 대진표를 풀었습니다. // 둘 씩 잘라서 계속 붙게 하면 언젠가 만나겠거니, 라는 생각으로 풀었습니다. const getOneRound = (arr) => { const answer = []; for (let i = 0; i { let humans = new Array(n).fill(0); humans[a - 1] = 1; humans[b - 1] = 1; let count = 0; loop1: while (true) { count++; humans = getOneRound(huma..
// 프로그래머스 레벨2 게임 맵 최단 거리를 풀었습니다. const solution = (maps) => { if (!maps[0][0]) { return -1; } const visited = new Array(maps.length); for (let i = 0; i { const queue = [{ y: startY, x: startX }]; visited[startY][startX] = 1; while (q..
// 프로그래머스 레벨 2 [카카오 인턴] 수식 최대화 const getPriority = () => { const operator = ["+", "-", "*"]; const priority = []; let visited; let answer; const dfs = (start) => { visited[start] = true; answer.push(operator[start]); if (answer.length === 3) { priority.push([...answer]); } for (let i = 0; i < operator.length; i++) { if (!visited[i]) { visited[i] = true; dfs(i); visited[i] = false; answer.pop(); ..
// 프로그래머스 레벨1 신규 아이디 추천을 풀었습니다. const firstRule = (str) => str.toLowerCase(); const secondRule = (str) => str .split("") .filter((el) => { const charCode = el.charCodeAt(); const aCode = "a".charCodeAt(); const zCode = "z".charCodeAt(); const zeroCode = "0".charCodeAt(); const nineCode = "9".charCodeAt(); if ( (zeroCode (str.length ? str : "a"); const sixthRule = (str) => { const next = str.leng..
// 프로그래머스 레벨 1 폰켓몬을 풀었습니다. const solution = (nums) => { const chance = parseInt(nums.length / 2); const max = Array.from(new Set(nums)).length; return max >= chance ? chance : max; };
// 프로그래머스 레벨 1 음양 더하기를 풀었습니다. const solution = (absolutes, signs) => { let sum = 0; for (let i = 0; i < absolutes.length; i++) { sum += signs[i] ? absolutes[i] : -absolutes[i]; } return sum; };
// 프로그래머스 레벨 1 약수의 개수와 덧셈을 풀었습니다. const countDiv = (n) => { const div = new Set(); for (let i = 1; i { let sum = 0; for (let i = left; i