일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 알고리즘
- HTTP
- javascript
- Algorithm
- HTTP 완벽 가이드
- 크롤링
- Node.js
- 쉬운 문제
- dfs
- 문자열
- TCP
- 타입 챌린지
- ip
- type challenge
- typescript
- 자바스크립트
- 소켓
- 수학
- 타입스크립트
- Nestjs
- 프로그래머스 레벨 2
- 그래프
- dp
- 레벨 1
- BFS
- 가천대
- 프로그래머스
- socket
- Crawling
- 백준
- Today
- Total
목록백준 (100)
kakasoo
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const graph = []; let N, M; rl.on("line", (line) => { if (!N) { [N, M] = line.split(" ").map(Number); } else { const row = line.split(" ").map(Number); graph.push(row); if (graph.length === N) { rl.close(); } } }).on("close", () => { const visited = []; for (let i = 0; i ..
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { main(line); rl.close(); }).on("close", () => { process.exit(); }); const findEmotion = (line, emotion) => { let count = 0; for (let i = 0; i < line.length - 3; i++) { if (line[i] === emotion[0]) { if (line[i + 1] === emotion[1]) { if (line[i + 2]..
// 백준 11365번 !밀비 급일을 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on("line", (line) => { if (line !== "END") { input.push(line); } else { main(); rl.close(); } }).on("close", () => { process.exit(); }); const main = () => { for (let i = 0; i < input.length; i++) { console.log(input[i].spl..
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { main(line); process.exit(); }); /** * * @param {string} line */ const main = (line) => { let [A, B] = line.split(" ").map(BigInt); if (A > B) { let temp = A; A = B; B = temp; } if (A === B || A + BigInt(1) === B) { console.log(0); return; } let a..
첫번째부터 두번째까지는 버블 정렬을 시도한 것이다. 그런데 시간 초과가 나왔다. 아니, 문제가 버블 정렬인데 버블 정렬 했다고 시간 초과라니, 문제가 잘못된 것 아닌가 해서 봤더니, A에 들어있는 수가 100만까지 나올 수 있다고 한다. 버블 정렬은 O(n^2) 이었으니까 100만의 제곱이면... 아하, 이건 해결할 수 없는 방식이었다. 이 문제는 버블 정렬을 시키진 않을 거면서 버블 정렬을 하면 몇 번이나 걸리는지를 묻는 문제였다. 그래서 방식을 바꾼 게, 버블 정렬이 어떤 조건에서 발생하는지를 보는 것이었다. 버블 정렬을 하면 각 자리 수는 좌측으로 한 칸씩 이동하게 된다. 예를 들어 예제처럼, 10, 1, 5, 2, 3의 숫자가 있다고 해보자. 1, 2, 3, 5, 10으로 정렬되어야 한다. 그러면..
// 백준 2178번 미로 탐색을 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let input = []; let N = 0; let M = 0; rl.on("line", (line) => { if (!N) { [N, M] = line.split(" ").map(Number); } else { input.push(line); if (input.length === N) { main(); process.exit(); } } }); const main = () => { const graph = []; const visi..
// 백준 4963번 섬의 개수를 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let input = []; let N = 0; let M = 0; rl.on("line", (line) => { if (!N) { if (line === "0 0") { process.exit(); } [M, N] = line.split(" ").map(Number); } else { input.push(line); if (input.length === N) { main(); N = 0; input = []; } } }); const ..
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; let count = 0; rl.on("line", (line) => { if (!count) { count = Number(line); } else { input.push(line); if (input.length === count) { main(); process.exit(); } } }); const main = () => { const graph = []; const visited = []; for (let i = 0; i < count; i+..
// 백준 1707번 이분 그래프를 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let count = 0; let input = []; rl.on("line", (line) => { if (!count) { count = Number(line); } else { input.push(line); if (input.length == Number(input[0].split(" ")[1]) + 1) { main(); input = []; } } }); const main = () => { const graph = []; ..
// 백준 10103번 주사위 게임을 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let count = 0; const input = []; rl.on("line", (line) => { if (!count) { count = Number(line); } else { input.push(line); if (input.length === count) { main(); rl.close(); } } }).on("close", () => { process.exit(); }); const main = () => { let ..
kscodebase.tistory.com/394 이전 문제에 JavaScript에 대한 단점들을 조금 나열했는데, 나름대로 깔끔하게 고쳐보고자 이번에는 중첩된 함수 구조를 사용했다. // 백준 11724번 연결요소의 게수를 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; let N = 0; let M = 0; rl.on("line", (line) => { if (!N) { [N, M] = line.split(" ").map(Number); } else { input.push(line);..
// 백준 1260번 DFS와 BFS를 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; let n = 0; let m = 0; let start = 0; rl.on("line", (line) => { if (!n) { [n, m, start] = line.split(" ").map(Number); } else { input.push(line); if (input.length === m) { main(); process.exit(); } } }); const dfs = (start) =>..