일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 스나이퍼팩토리
- Server State
- 컴포넌트설계
- pnpm
- 상태 관리 라이브러리
- stompjs
- 배열
- 배열메서드
- 실시간통신
- sucoding
- React Query
- 프론트엔드
- 프로젝트
- 공식문서
- shadcn
- 수코딩
- React
- 프로젝트캠프
- tanstack query
- 라이브러리
- 자바스크립트
- @stomp/stompjs
- radixui
- frontend
- MDN
- TypeScript
- 리액트프로젝트
- JavaScript
- npm
- 코딩테스트
- Today
- Total
목록Coding Test (54)
yunicornlab
백준 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번..
백준 14395번 4연산 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/14395 1) 메모리 초과로 실패new Array(t+1)이 문제인 듯 하다.let fs = require('fs');let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');let [s, t] = input[0].split(' ').map(Number);if (s == t) { console.log(0); process.exit();}class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0;..
백준 1707번 이분 그래프 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/1707 while 문으로 BFS 돌리기 전에 모든 노드를 순회하는 for문을 추가해줬어야 했다.이것 때문에 한참 헤맸다../* '/dev/stdin'*/let path = 'input.txt';let fs = require('fs');let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');let testCase = Number(input[0]);let t = 1;class Queue { constructor() { this.items = {}; this.head = 0; ..
백준 7562번 나이트의 이동 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/7562 let fs = require('fs');let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');let testCase = Number(input[0]);class Queue { constructor() { this.items = {}; this.head = 0; this.tail = 0; } enqueue(element) { this.items[this.tail] = element; this.tail++; } dequeue() { le..
백준 21921번 블로그 문제를 자바스크립트로 투포인터 알고리즘을 이용해서 풀어보았다.https://www.acmicpc.net/problem/21921 let fs = require('fs');let input = fs.readFileSync('/dev/stdin').toString().split('\n');// 총 일수 N, 계산하고자 하는 기간 X일let [n, x] = input[0].split(' ').map(Number);let visitors = input[1].split(' ').map(Number);// 최대 방문자 수let maxVisit = 0;// 최대 방문자 수를 달성한 기간 수let count = 0;// 투포인터를 위한 start, end, 현재 방문자수의 합 설정let sta..
백준 11441번 합 구하기 문제를 자바스크립트로 누적합 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/11441 let fs = require('fs');let input = fs.readFileSync('/dev/stdin').toString().split('\n');// 주어지는 수의 개수 Nlet n = Number(input[0]);// A1, A2, ..., Anlet numbers = input[1].split(' ').map(Number);// 구간의 개수 Mlet m = Number(input[2]);// 구간합let prefix = [0];for (let i=1; i
백준 1697번 숨바꼭질 문제를 자바스크립트로 BFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/1697 // 큐 자료구조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]; delete this.items[this.head]; this.head++; return element; }; getLength(..
백준 2606번 바이러스 문제를 자바스크립트로 DFS 알고리즘을 이용해서 풀어보았다. https://www.acmicpc.net/problem/2606 let fs = require('fs');let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');// 컴퓨터의 수let n = Number(input[0]);// 연결 수let m = Number(input[1]);// 주어진 연결 정보let pair = [];for (let i=2; i