본문 바로가기

728x90

Algorithm

[NodeJS] leetcode 788. Rotated Digits var rotatedDigits = function (n) { let answer = 0; const nums = [0, 1, 5, -1, -1, 2, 9, -1, 8, 6]; loop1: for (let i = 1; i 더보기
[NodeJS] 백준 11399 /** * @link https://www.acmicpc.net/problem/11399 */ 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] = strToNumberArr(input[0]); const timeArr = strToNumberArr(input.. 더보기
[NodeJS] 백준 11047 /** * @link https://www.acmicpc.net/problem/11047 */ 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, k] = strToNumberArr(input.shift()); const result = solution(n, k.. 더보기
[NodeJS] 백준 1931 /** * @link https://www.acmicpc.net/problem/1931 */ 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 arr = input.map((s) => strToNumberAr.. 더보기
[NodeJS] 백준 1764 /** * @link https://www.acmicpc.net/problem/1764 */ 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] = strToNumberArr(input.shift()); const listen = input.slice(0,.. 더보기
[NodeJS] 백준 1676 /** * @link https://www.acmicpc.net/problem/1676 */ 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; let num = n; let answer = 0; while (5 더보기
[NodeJS] 백준 1620 /** * @link */ 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] = strToNumberArr(input.shift()); const question = [...Array(m)].map(() => input.pop()).reverse(); c.. 더보기
[NodeJS] 백준 1541 /** * @link https://www.acmicpc.net/problem/1541 */ 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 result = solution(input[0]); console.log(result); process.exit(); }); /** * * @param {string} str */ function solution(str) { con.. 더보기

728x90