๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ

(230)
[IT 5๋ถ„ ์žกํ•™์‚ฌ์ „] Day 1. ์ฑ… ๊ตฌ๋งค ์ธ์ฆ ๋“œ๋””์–ด ๊ธฐ๋‹ค๋ฆฌ๋˜ ๋…ธ๊ฐœ๋ถ์ด ๋‹ค์‹œ ์—ด๋ ธ๋‹ค. ์ด์ „์— ์ฑŒ๋ฆฐ์ง€ ์‹ ์ฒญ์„ ํ–ˆ์—ˆ์ง€๋งŒ ์ฑŒ๋ฆฐ์ง€ ์ž์ฒด๊ฐ€ ์ทจ์†Œ๋˜๋Š” ๋ฐ”๋žŒ์— ์ฑ…์„ ์‚ฌ๋†“๊ณ ๋„ ์•„์‰ฝ๊ฒŒ ๋ชปํ–ˆ์—ˆ๋‹ค. ์ดํ›„์— ํ˜ผ์ž ์ฝ์–ด๋ณผ๊นŒ๋„ ํ–ˆ๋Š”๋ฐ ์ƒ๊ฐ๋ณด๋‹ค ์‰ฝ์ง€ ์•Š์•˜๋‹ค...! ๋ฌดํŠผ ์ฑŒ๋ฆฐ์ง€๋ฅผ ํ•˜๋ฉฐ ์ข€ ๋” ๊ผผ๊ผผํžˆ ์ฝ์–ด๋ณด๊ณ  ๋ถ€์กฑํ•œ ๊ฐœ๋…๋“ค์„ ๋จธ๋ฆฌ ์†์— ์ฑ„์šฐ๋Š” ์ข‹์€ ์‹œ๊ฐ„์ด ๋  ๊ฒƒ ๊ฐ™๋‹ค!
[์•Œ๊ณ ๋ฆฌ์ฆ˜ || ๋ฐฑ์ค€] node JS 2566 ์ตœ๋Œ“๊ฐ’ ์•„ ๋„๋Œ€์ฒด ์™œ ํ‹€๋ ธ์ง€ ๋ถ„๋ช… ๋งž๋Š”๋ฐ ๋ผ๊ณ  ์ƒ๊ฐํ•˜๋‹ค๊ฐ€ ์งˆ๋ฌธํ•˜๊ธฐ์—์„œ ๋ฐ˜๋ก€๋ฅผ ๋ฐœ๊ฒฌํ–ˆ๋‹ค. let input = require('fs').readFileSync('./dev/stdin').toString().trim().split("\n").map(v => v.replace("\r", "")); let max = 0; let location = "" for (let i = 0; i max) { max = num[j] location = `${i + 1} ${j + 1}` }; } } console.log..
[์•Œ๊ณ ๋ฆฌ์ฆ˜ || ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ์‹ ๊ณ  ๊ฒฐ๊ณผ ๋ฐ›๊ธฐ function solution(id_list, report, k) { const reported = new Map(id_list.map(name => [name, 0])); let whomReported = {}; const reportedCount = {}; [...new Set(report)].forEach(couple => { const [์‹ ๊ณ ์ž, ํ”ผ์‹ ๊ณ ์ž] = couple.split(" "); whomReported[ํ”ผ์‹ ๊ณ ์ž] ? whomReported[ํ”ผ์‹ ๊ณ ์ž].push(์‹ ๊ณ ์ž) : whomReported[ํ”ผ์‹ ๊ณ ์ž] = [์‹ ๊ณ ์ž]; reportedCount[ํ”ผ์‹ ๊ณ ์ž] ? reportedCount[ํ”ผ์‹ ๊ณ ์ž]++ : reportedCount[ํ”ผ์‹ ๊ณ ์ž] = 1; }); const ์ •์ง€์œ ์ € = Obj..
[์•Œ๊ณ ๋ฆฌ์ฆ˜ || ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ๋‹ฌ๋ฆฌ๊ธฐ ๊ฒฝ์ฃผ function solution(players, callings) { //player ์˜ ๋ฐฐ์—ด -> callings ์˜ ์ˆœ์„œ ์— ํ•ด๋‹นํ•œ๋Š” ์„ ์ˆ˜์™€ ๊ทธ ์•ž์˜ ์„ ์ˆ˜์˜ ๋ฒˆํ˜ธ๋ฅผ ๋ฐ”๊ฟˆ //callings ๋ฅผ foreach ๋กœ ๋ˆ๋‹ค //callings ์— ์ด๋ฆ„์„ players ์—์„œ indexOf ๋กœ ์ฐพ๊ณ , //index-1 ๊ณผ ์ˆœ์„œ๋ฅผ ๋ฐ”๊พผ๋‹ค. => ์ด์ „ ์„ ์ˆ˜๋ฅผ ์ฐพ๊ณ , ๋จผ์ € ์ด๋ฆ„์„ ๋„ฃ๋Š”๋‹ค. callings.forEach(call => { const callIndex = players.findIndex(v => v === call) const fall = players[callIndex - 1]; players[callIndex] = fall; players[callIndex - 1] = call; console.log..
[์•Œ๊ณ ๋ฆฌ์ฆ˜ || ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ๊ฐœ์ธ์ •๋ณด ์ˆ˜์ง‘ ์œ ํšจ๊ธฐ๊ฐ„ ์–ด.... ์ฒจ์— ์ž‘์„ฑํ•˜๋˜ ์ฝ”๋“œ์—์„œ ๋‚ ์งœ ๊ณ„์‚ฐ์ด ๋„ˆ๋ฌด ํ—ท๊ฐˆ๋ ค์„œ ๊ณ„์† 2-3๊ฐœ์”ฉ ์ผ€์ด์Šค ์‹คํŒจ๊ฐ€ ๋–ด๋‹ค. function solution(today, termsSt, privacies) { const terms = Object.fromEntries(termsSt.map(t => [t.split(" ")[0], Number(t.split(" ")[1])] )); today = today.split(".").map(Number); return privacies.reduce((acc, p, i) => { let [y, m, d] = p.split(" ")[0].split(".").map(Number); const type = p.split(" ")[1]; let limitDate = Array(3); const su..
[์•Œ๊ณ ๋ฆฌ์ฆ˜ || ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ํ‚คํŒจ๋“œ ๋ˆ„๋ฅด๊ธฐ, ์ •๊ทœ์‹ test() ํ•จ์ˆ˜ (feat.๋น„๋‚œ๋‹˜์˜ ์ฝ”๋“œ๋ฆฌ๋ทฐ) ์˜ค๋Š˜๋„ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ๋“ค์„ ์ˆœ์„œ๋Œ€๋กœ ๋จผ์ € ๋‚˜์—ดํ•ด๋ดค๋‹ค. function solution(numbers, hand) { const click = []; const keypad = [ [1, 2, 3], [4, 5, 6], [7, 8, 9], ['*', 0, '#'] ] const findKey = (n) => { let result = []; keypad.forEach((line, i) => { if (line.findIndex(v => v === n) !== -1) { result = [i, line.findIndex(v => v === n)]; return; } }) return result; } let [leftNow, rightNow] = [[3, 0], [3, 2]]; numbers.forEach(..
[์•Œ๊ณ ๋ฆฌ์ฆ˜ || ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค] ํฌ๋ ˆ์ธ ์ธํ˜• ๋ฝ‘๊ธฐ ๊ฒŒ์ž„ ์˜ค๋Š˜์€ ๊ฐ•์˜์—์„œ ๋ฐฐ์šด ๋Œ€๋กœ ๋จผ์ € ์–ด๋–ค๊ฒŒ ์ฃผ์–ด์กŒ๊ณ , ์–ด๋–ค ๊ฑธ ๊ตฌํ•ด์•ผ ํ•˜๋Š”์ง€ ์ •๋ฆฌ๋ฅผ ๋จผ์ € ํ•ด๋‘๊ณ , ๊ทธ ๋‹ค์Œ์— ์–ด๋–ค ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ•ด์•ผ ํ•˜๋Š”์ง€ ์จ๋ดค๋‹ค. ์ด ๊ณผ์ •๋„ ํ…Œ์ŠคํŠธ์˜ ์ผ๋ถ€๋ผ๊ณ  ์ƒ๊ฐํ•˜๊ณ  ์“ฐ๋‹ˆ ๋‹จ๊ณ„๋ณ„๋กœ ์ฐจ๊ทผ์ฐจ๊ทผ ์“ธ ์ˆ˜ ์žˆ์—ˆ๋‹ค. 0. 2์ฐจ์› ๋ฐฐ์—ด๊ณผ 1์ฐจ์› ๋ฐฐ์—ด์ด ์ฃผ์–ด์ง„๋‹ค. / return ํ•˜๋Š” ๊ฑด count ๋œ ์ˆซ์ž 1. 2์ฐจ์› ๋ฐฐ์—ด์—์„œ moves ๋ฐฐ์—ด์˜ ํ–‰ ์ค‘ ๊ฐ€์žฅ ์œ„์— ์žˆ๋Š” ์ˆ˜ ์ค‘ 0 ์ด ์•„๋‹Œ ์ˆ˜ ๋ฅผ ์ฐพ๋Š”๋‹ค. 2. ์ž„์˜์˜ ๋ฐ”๊ตฌ๋‹ˆ array ๋ฅผ ๋งŒ๋“ ๋‹ค. 3. 1๋ฒˆ์—์„œ ์ฐพ์€ 0์ด ์•„๋‹Œ ์ˆ˜๋ฅผ array ์— ๋„ฃ๋Š”๋‹ค. 4. ๋ฐ”๊ตฌ๋‹ˆ์—์„œ ๊ฐ™์€ ์ˆ˜2๊ฐœ๊ฐ€ ์žˆ๋‹ค๋ฉด ์ œ๊ฑฐํ•œ๋‹ค. 5. ์ œ๊ฑฐ ๋œ ์ธํ˜•์˜ ๊ฐœ์ˆ˜๋ฅผ ๊ตฌํ•œ๋‹ค. (์ œ๊ฑฐ๋˜๋Š” ๊ณผ์ •์ด ๋ฐ˜๋ณต๋œ ์ˆ˜ *2 ๋ฅผ ํ•ด๋„ ๋จ) 4๋ฒˆ์€ ๋”ฐ๋กœ ์ง„ํ–‰ํ•˜๋Š” ๊ฒƒ๋ณด๋‹ค 3๋ฒˆ์„ ์ง„ํ–‰ํ•˜๋ฉด์„œ ํ™•์ธํ•˜๋ฉฐ ์ง„ํ–‰ํ•˜๋Š”๊ฒŒ ๋”..
[์•Œ๊ณ ๋ฆฌ์ฆ˜] How do you improve? ๋ฌธ์ œ ํ•ด๊ฒฐ ์ ‘๊ทผ๋ฒ• ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํ’€์ด๋ฅผ ๋‚˜๋ฆ„ ํ•ด์™”์ง€๋งŒ, ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๊ณต๋ถ€๋Š” ๋”ฐ๋กœ ํ•ด๋ณธ์ ์ด ์—†๋‹ค. ๊ทธ๋ž˜์„œ ์ง€๊ธˆ 1๋‹จ๊ณ„ ํ›„๋ฐ˜์œผ๋กœ ๋„˜์–ด๊ฐ€๋Š” ์‹œ์ ์—์„œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ œ๋Œ€๋กœ ํ‘ธ๋Š” ๋ฒ•์„ (์ง€๊ธˆ์ด๋ผ๋„) ๋ฐฐ์›Œ๋ณด๊ธฐ๋กœ ํ–ˆ๋‹ค. 1๋‹จ๊ณ„. ๋ฌธ์ œ ์ดํ•ดํ•˜๊ธฐ 1. ๋ฌธ์ œ๋ฅผ ๋‚˜๋งŒ์˜ ์–ธ์–ด๋กœ ํ‘œํ˜„ํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€? 2. ์–ด๋–ค ์ž๋ฃŒ๊ฐ€ ๋“ค์–ด์˜ค๋Š”๊ฐ€? 3. ๋„์ถœ๋˜์–ด์•ผ ๊ฒฐ๊ณผ๋Š” ๋ฌด์—‡์ธ๊ฐ€? (์ถœ๋ ฅ ๊ฐ’์ด ์–ด๋–ป๊ฒŒ ๋‚˜์™€์•ผ ํ•˜๋Š”๊ฐ€) 4. ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ถฉ๋ถ„ํ•œ ์ •๋ณด๊ฐ€ ์ฃผ์–ด์กŒ๋Š”๊ฐ€? (์ฃผ์–ด์ง„ ๋ฐ์ดํ„ฐ๋งŒ ๊ฐ€์ง€๊ณ  ์›ํ•˜๋Š” ๊ฐ’์„ ์ถœ๋ ฅํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€) 5. ๋ฌธ์ œ์˜ ์ผ๋ถ€์ธ ๋ฐ์ดํ„ฐ์˜ ์ค‘์š”ํ•œ ๋ถ€๋ถ„์— ์–ด๋–ป๊ฒŒ ๋ผ๋ฒจ์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€ => ๋ฌธ์ œ์—์„œ ์ •๋ง ์ค‘์š”ํ•œ ๊ฒƒ์ด ๋ฌด์—‡์ธ๊ฐ€ ์‹ค์ œ๋กœ ๋ฌธ์ œ๋ฅผ ํŒŒ์•…ํ–ˆ๋‹ค๋ฉด, ์˜ˆ์‹œ๋ฅผ 1-2๊ฐœ ๋งŒ๋“ค์–ด๋ณด๊ธฐ. ์‰ฌ์šด ์˜ˆ์‹œ -> ๋ณต์žกํ•œ ์˜ˆ์‹œ Empty inputs, Invaild inputs ์— ๋Œ€ํ•œ ..

728x90
๋ฐ˜์‘ํ˜•