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

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on("line", (line) => { input.push(line); }).on("close", () => { const map = input.map((row) => row.split(" ")); const nullPoint = []; for (let i = 0; i < map.length; i++) { for (let j = 0; j < map[i].length; j++) { if (map[i][j] == 0) { nullPoint.push..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { const num = Number(line); const rows = new Array(num + 1).fill(0).map((el) => 0); const isAble = (row) => { for (let i = 1; i < row; i++) { if ( rows[i] === rows[row] || Math.abs(rows[row] - rows[i]) === row - i ) { return false; } } return true;..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on("line", (line) => { input.push(line); }).on("close", () => { const num = Number(input.splice(0, 1)) + 1; const expression = input[0].split(" "); const numbers = new Array(10).fill(0).map((el, i) => i); const visited = new Array(10).fill(false); con..

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 32 33 34 35 36 37 38 39 #include using namespace std; int startLink[21]; int arr[21][21]; int visited[21]; int n; void dfs(int cnt, int start) { if (cnt == n / 2) { for (int i = 0; i

알고리즘 구분 알고리즘을 공부하며 가장 헷갈린 것이, 알고리즘의 이름이 무얼 의미하는지 몰랐던 부분이었다. n-Queen 문제를 풀 때도, 풀이를 보고 신기했던 경험이 있었지만 백트래킹에 대한 이해는 얕았다. 그러나 그것이 스도쿠 문제를 풀면서 완전한 이해로 갖춰지게 된 거 같다. 일단 기본적으로, 브루트 포스가 있다. 브루트 포스는 for문이든 중첩된 for문이든 간에 모든 경우의 수를 다 찾아보는 방식이다. 이 브루트 포스에서 방문한 칸을 체크하는 것으로 효율을 꾀하는 것이 dfs와 bfs로 나타난다. 그러나 dfs는 갈래의 마지막까지 방문한 다음에 옳고 그름을 판단하는데, 다음의 문제가 있다 1) 만약 재귀가 끝나지 않는다면? -> 런 타임 에러가 발생한다. 2) 중간에 틀린 걸 판별했다면? -> ..