node

CS/Data Structure & algorithm

[Algorithm] 백준 6105 - Look Up (Node / C#)

문제https://www.acmicpc.net/problem/6105 풀이1. Node.js(fs)const fs = require('fs');const input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');const N = parseInt(input[0]);const heights = input.slice(1).map(Number);function findLookUp(heights) { const stack = []; const result = new Array(N).fill(0); for (let i = N - 1; i >= 0; i--) { while (stack.length > 0 && heights[..

CS/Data Structure & algorithm

[Algorithm] 백준 5966 - Cow Cotillion (Node / C#)

문제https://www.acmicpc.net/problem/5966 풀이1. Node.js(fs)const fs = require('fs');const input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');const N = parseInt(input[0]);function isLegal(pattern) { const stack = []; for (let char of pattern) { if (char === '>') { stack.push(char); } else if (char === '') { return false; } ..

CS/Data Structure & algorithm

[Algorithm] 백준 5957 - Cleaning the Dishes (Node / C#)

문제https://www.acmicpc.net/problem/5957 풀이1. Node.js(fs)const fs = require('fs');const input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');const N = parseInt(input[0]);let unwashed = Array.from({length: N}, (_, i) => N - i);let washed = [];let dried = [];for (let i = 1; i 0) { washed.push(unwashed.pop()); } } } else { // Canmuu drying f..

CS/Data Structure & algorithm

[Algorithm] 백준 5397 - 키로거 (Node / C#)

문제https://www.acmicpc.net/problem/5397 풀이1. Node.js(fs)const fs = require('fs');const input = fs.readFileSync('/dev/stdin').toString().trim().split('\n');const T = parseInt(input[0]);function processKeyLogger(str) { const leftStack = []; const rightStack = []; for (let char of str) { if (char === ' 0) { rightStack.push(leftStack.pop()); } } else i..

개발자참치
'node' 태그의 글 목록