JavaScript 썸네일형 리스트형 [NodeJS] 백준 18870 const readline = require('readline'); const strToNumberArr = (str) => str.split(' ').map(Number); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on('line', (line) => { input.push(line); }).on('close', () => { const [, str] = input; const result = solution(strToNumberArr(str)); console.log(result.join(' ')); process.exit(); }); /** * *.. 더보기 [NodeJS] 백준 11398 /** * @link https://www.acmicpc.net/problem/13398 */ const readline = require('readline'); const strToNumberArr = (str) => str.split(' ').map(Number); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on('line', (line) => { input.push(line); }).on('close', () => { const [, str] = input; const result = solution(strToNumberArr(str)); conso.. 더보기 [NodeJS] qorwns 11724 /** * @link https://www.acmicpc.net/problem/11724 */ const readline = require('readline'); const strToNumberArr = (str) => str.split(' ').map(Number); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on('line', (line) => { input.push(line); }).on('close', () => { const [[n, m], ...arr] = input.map(strToNumberArr); const result = solutio.. 더보기 [NodeJS] 백준 11279 /** * @link https://www.acmicpc.net/problem/11279 */ const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on('line', (line) => { input.push(Number(line)); }).on('close', () => { const n = input.shift(); const result = solution(n, input); console.log(result.join('\n')); process.exit(); }); /** * * @param.. 더보기 [NodeJS] 백준 2630 /** * @link https://www.acmicpc.net/problem/2630 */ const readline = require('readline'); const strToNumberArr = (str) => str.split(' ').map(Number); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on('line', (line) => { input.push(line); }).on('close', () => { const n = Number(input.shift()); const board = input.map(strToNumberArr); c.. 더보기 Javascript Queue 구현하기 class Queue { constructor() { this.storage = {}; this.firstIndex = 0; this.lastIndex = 0; } add(value) { if(this.size() === 0) { this.storage['0'] = value; } else { this.lastIndex++; this.storage[this.lastIndex] = value; } } popLeft() { let temp; if(this.firstIndex === this.lastIndex) { temp = this.storage[this.firstIndex]; delete this.storage[this.firstIndex]; this.firstIndex = 0; this.lastInde.. 더보기 Javascript Stack 구현하기 class Stack { constructor(items) { this.index = 0; this.storage = {}; if (items) { const { storage, index } = items.reduce( (obj, curVal) => { obj.storage[++obj.index] = curVal; return obj; }, { storage: {}, index: 0 }, ); this.storage = storage; this.index = index; } } push = (item) => { this.storage[++this.index] = item; }; pop = () => { // 스택에 데이터가 없는 경우 if (this.index === 0) { return undefin.. 더보기 Javascript 랜덤 숫자 함수 /** * Generate a random number between two numbers * @param {number} min * @param {number} max */ const GenerateRandomNumber = (min, max) => { return Math.floor(Math.random() + (max - min + 1) + min); }; 더보기 이전 1 2 3 4 5 6 7 8 ··· 18 다음