Jayden`s

    [JS] 2231

    const fs = require('fs'); const { stringify } = require('querystring'); const path = process.platform === 'linux' ? '/dev/stdin' : './data.txt'; let input = fs.readFileSync(path).toString().trim(); function solve(input) { let N = parseInt(input); let answer = []; for (let i = 0; i parseI..

    [JS] 2798

    const fs = require('fs'); const path = process.platform === 'linux' ? '/dev/stdin' : './data.txt'; const input = fs.readFileSync(path).toString().trim().split('\n'); function solve(input) { const [N, M] = input[0].split(' ').map((x) => parseInt(x)); const cardNums = input[1].split(' ').map((x) => parseInt(x)); const answer = new Array(); for (let i of cardNums) { for (let j of cardNums) { for (l..

    220607(ํ™”) ํ‡ด์ง์—ฐ๊ธˆ ๋””ํดํŠธ์˜ต์…˜

    220607(ํ™”) ํ‡ด์ง์—ฐ๊ธˆ ๋””ํดํŠธ์˜ต์…˜

    ๋‹ค์Œ๋‹ฌ๋ถ€ํ„ฐ ํ‡ด์ง์—ฐ๊ธˆ ๋””ํดํŠธ์˜ต์…˜ ๋„์ž… ๊ฐ„๋‹จํžˆ ๋งํ•˜๋ฉด ํ‡ด์ง์—ฐ๊ธˆ์„ DBํ˜•, DCํ˜•์œผ๋กœ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, DCํ˜•์€ ์—ฐ๊ธˆ์„ ๋ณธ์ธ์ด ์›ํ•˜๋Š” ํŽ€๋“œ ๋ฐ ํˆฌ์ž์— ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํ˜•ํƒœ์ด๋‹ค. ๋‹ค๋งŒ, DCํ˜•์œผ๋กœ ๊ฐ€์ž…ํ•ด๋†“๊ณ  ํŠน์ • ์ƒํ’ˆ์— ๋Œ€ํ•œ ์ง€์‹œ๋ฅผ ํ•˜์ง€ ์•Š์•„ ํ™œ์šฉ๋˜์ง€ ๋ชปํ•˜๋Š” ํ‡ด์ง์—ฐ๊ธˆ๋“ค์ด ๋งŽ์•˜๋‹ค. ์ด์ œ ์ด๋ฅผ ํ™œ์šฉํ•˜๊ธฐ ์œ„ํ•ด ๋””ํดํŠธ์˜ต์…˜์„ ๊ฑธ์–ด๋‘์–ด ๊ทผ๋กœ์ž๊ฐ€ ์‚ฌ์ „์— ์ •ํ•œ ์ƒํ’ˆ์œผ๋กœ ์ฆ๊ถŒ์‚ฌ๊ฐ€ ์šด์šฉํ•˜๋„๋กํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ์ž˜ ํ™œ์šฉ๋งŒ ๋œ๋‹ค๋ฉด ๊ทผ๋กœ์ž๋„, ์ฆ๊ถŒ์‚ฌ๋„ ์œˆ์œˆํ•  ์ˆ˜ ์žˆ๋Š” ์ œ๋„๊ฐ€ ๋  ๊ฒƒ ๊ฐ™๋‹ค.

    [JS] ํ•ด์‹œ - ์™„์ฃผํ•˜์ง€ ๋ชปํ•œ ์„ ์ˆ˜

    function solution(participant, completion) { let answer; participant.sort(); completion.sort(); for (let i = 0; i < participant.length; i++) { if (participant[i] !== completion[i]) { answer = participant[i]; break; } } return answer; } // ํ•ด์‹œ ๋ฌธ์ œ๋ผ๋Š” ์ ์„ ๊ฐ์•ˆํ–ˆ์„ ๋•Œ, ์ข‹์€ ํ’€์ด function solution(participant, completion) { const map = new Map(); for(let i = 0; i < participant.length; i++) { let a = participant[..

    [JS]์™„์ „ํƒ์ƒ‰-๋ชจ์˜๊ณ ์‚ฌ

    function solution(answers) { const lengthAns = answers.length; const first = [1, 2, 3, 4, 5]; const second = [2, 1, 2, 3, 2, 4, 2, 5]; const third = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]; const firstAns = new Array(Math.ceil(lengthAns / first.length)) .fill(first) .flat(); const secondAns = new Array(Math.ceil(lengthAns / second.length)) .fill(second) .flat(); const thirdAns = new Array(Math.ceil(lengt..