일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 유데미
- 웅진씽크빅
- TypeScript
- 공식문서
- 프론트엔드
- 수코딩
- React Query
- 프로젝트캠프
- 개발
- tanstack query
- 리액트프로젝트
- STATE
- sucoding
- React
- Server State
- 스나이퍼팩토리
- frontend
- 상태 관리 라이브러리
- 프론트엔드 개발
- Today
- Total
목록Coding Test/Practice (51)
yunicornlab

백준 1300번 K번째 수 문제를 자바스크립트로 이진 탐색 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/1300 어려웠다 ㅠㅠㅠ만약 B 배열이 [1, 2, 2, 3, 3, 4, 6, 6, 9] 이렇게고, k=7이면 답은 6이다.→ mid = 5로 시작해서, 5(mid)보다 작거나 같은 데이터의 수가 7(k)개 이상이 될 때, 이 mid를 출력하면 답이다.-> mid = 5일 때는, 5보다 작거나 같은 데이터의 수가 6개이고, 이 개수가 k=7보다 작으므로 mid값을 증가시키기 위해 start = mid + 1 해줘야 함반대로, 개수가 k보다 크면 mid 값을 감소시켜줘야 하므로 end = mid 해줘야 함 1) 실패 -> mid보다 작거나 같은 데이터의 수를..
백준 10816번 숫자 카드 2 문제를 자바스크립트로 이진 탐색 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/10816 1) 이진 탐색 안쓰고 단순 구현 -> 이 코드도 통과됨let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");// 가지고 있는 숫자 카드 N개let n = Number(input[0]);let have = input[1].split(' ').map(Number);// 비교할 숫자 카드 M개let m = Number(input[2]);let stand = input[3].split(' ').map(Number);let countM..
백준 3190번 뱀 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/3190 으아 복잡해let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0; } enqueue(element) { this.items[this.tail] = element; this.tail++; } dequeue() { const element = this.items[this.he..
백준 16234번 인구 이동 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/16234 let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0; } enqueue(element) { this.items[this.tail] = element; this.tail++; } dequeue() { const element = this.items[this.he..
백준 16953번 A -> B 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/16953 let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0; } enqueue(element) { this.items[this.tail] = element; this.tail++; } dequeue() { const element = this.items[this.h..
백준 2638번 치즈 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/2638 let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0; } enqueue(element) { this.items[this.tail] = element; this.tail++; } dequeue() { const element = this.items[this.head]; ..
백준 5567번 결혼식 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/5567 let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0; } enqueue(element) { this.items[this.tail] = element; this.tail++; } dequeue() { const element = this.items[this.head];..
백준 5214번 환승 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/5214 1) 처음 작성한 코드 -> 메모리 초과로 실패let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0; } enqueue(element) { this.items[this.tail] = element; this.tail++; } dequeue() { const element..
백준 18352번 특정 거리의 도시 찾기 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/18352 let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0; } enqueue(element) { this.items[this.tail] = element; this.tail++; } dequeue() { const element = this.items[..
백준 18405번 경쟁적 전염 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/18405 1) 처음 시도 -> 처음 상태를 큐에 넣을 때 바이러스 번호 순서 고려가 안돼서 실패let fs = require("fs");let input = fs.readFileSync('/dev/stdin').toString().trim().split("\n");// n x n 크기의 시험관, 1번부터 k번까지의 바이러스let [n, k] = input[0].split(" ").map(Number);// 시험관 정보let graph = [];for (let i = 1; i 0) { let queueLen = queue.getLength(); // 1번..