일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 백준
- type challenge
- HTTP
- dfs
- 자바스크립트
- Crawling
- Nestjs
- HTTP 완벽 가이드
- 문자열
- 쉬운 문제
- 수학
- dp
- Node.js
- 프로그래머스 레벨 2
- 크롤링
- 소켓
- TCP
- ip
- javascript
- 타입스크립트
- typescript
- socket
- BFS
- 가천대
- 프로그래머스
- Algorithm
- 레벨 1
- 그래프
- 타입 챌린지
- 알고리즘
- Today
- Total
목록javascript (104)
kakasoo
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/tMfbx/btq8mgbyxIr/qouNo0ew5wiYO1j66t1L2K/img.png)
// 프로그래머스 레벨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..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Eq75L/btq8mZtSuvD/MDkEIEO4tQ6LL0l9OttHSk/img.png)
/** * 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..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Mezye/btq8pOeNMNS/3uv6CrkOX50GXtITauvrD0/img.png)
// 프로그래머스 레벨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
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/QAYH6/btq8rR2Dqvw/hKGHLc2mz8fSseaQxaCCi1/img.png)
// 프로그래머스 레벨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..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cFQAP1/btq8mZUX4UF/hfsUm2QTFPyWCwCwhmAUo1/img.png)
// 프로그래머스 레벨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..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Kzgge/btq8sCDKHYU/snTmzJtls3D6pos5kW6rUK/img.png)
// 프로그래머스 레벨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..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/V7nrJ/btq8ui6hvAi/pKXq57NCvTWEG4vUc4j2V1/img.png)
// 프로그래머스 레벨 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(); ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/nXJqS/btq8uiZxiqc/XKH60oT9QgW8TA3ROoPeT1/img.png)
// 프로그래머스 레벨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..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/YF0zE/btq8s7jDv44/ZI7OwaeSfzOtg7tw4hP9sk/img.png)
// 프로그래머스 레벨 1 폰켓몬을 풀었습니다. const solution = (nums) => { const chance = parseInt(nums.length / 2); const max = Array.from(new Set(nums)).length; return max >= chance ? chance : max; };
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/b9vdZJ/btq8ujKTIjN/zs25cWwDnztoF1GxoItpMK/img.png)
// 프로그래머스 레벨 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; };
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/t0StN/btq8mZtRpYw/P5f0LFhPZgWo7CFkHGe7j1/img.png)
// 프로그래머스 레벨 1 약수의 개수와 덧셈을 풀었습니다. const countDiv = (n) => { const div = new Set(); for (let i = 1; i { let sum = 0; for (let i = left; i