From 7e28fe6cac13a714fde6005975ca5baf11e43a8d Mon Sep 17 00:00:00 2001 From: yoouyeon Date: Thu, 4 Dec 2025 10:45:45 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=92=A1=20=ED=94=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=EB=A8=B8=EC=8A=A4=20159994=20-=20=EC=B9=B4=EB=93=9C?= =?UTF-8?q?=20=EB=AD=89=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\353\223\234_\353\255\211\354\271\230.js" | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git "a/Programmers/Level1/159994_\354\271\264\353\223\234_\353\255\211\354\271\230.js" "b/Programmers/Level1/159994_\354\271\264\353\223\234_\353\255\211\354\271\230.js" index 5693524..679a410 100644 --- "a/Programmers/Level1/159994_\354\271\264\353\223\234_\353\255\211\354\271\230.js" +++ "b/Programmers/Level1/159994_\354\271\264\353\223\234_\353\255\211\354\271\230.js" @@ -5,7 +5,25 @@ 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/159994 */ -function solution(cards1, cards2, goal) { +// ANCHOR - 2025.12.04 풀이 +function solution2(cards1, cards2, goal) { + let front1 = 0; + let front2 = 0; + let len1 = cards1.length; + let len2 = cards2.length; + + for (let idx = 0; idx < goal.length; idx++) { + const target = goal[idx]; + if (front1 < len1 && cards1[front1] === target) front1++; + else if (front2 < len2 && cards2[front2] === target) front2++; + else return "No"; + } + + return "Yes"; +} + +// ANCHOR - 2025.10.05 풀이 +function solution1(cards1, cards2, goal) { let idx1 = 0; let idx2 = 0; let goalIdx = 0; From 00ab09ebd1800d4fb85c94d8c13c4df48ef276db Mon Sep 17 00:00:00 2001 From: yoouyeon Date: Thu, 4 Dec 2025 11:10:28 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=92=A1=20=ED=94=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=EB=A8=B8=EC=8A=A4=2042586=20-=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60\353\212\245\352\260\234\353\260\234.js" | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git "a/Programmers/Level2/42586_\352\270\260\353\212\245\352\260\234\353\260\234.js" "b/Programmers/Level2/42586_\352\270\260\353\212\245\352\260\234\353\260\234.js" index 5af9310..61a7bbe 100644 --- "a/Programmers/Level2/42586_\352\270\260\353\212\245\352\260\234\353\260\234.js" +++ "b/Programmers/Level2/42586_\352\270\260\353\212\245\352\260\234\353\260\234.js" @@ -5,7 +5,36 @@ 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/42586 */ -function solution(progresses, speeds) { +// ANCHOR - 2025.12.04 풀이 +function solution2(progresses, speeds) { + let answer = []; + let currentDay = 1; + let deployCount = 0; + + while (deployCount < progresses.length) { + let completedCount = deployCount; + // 작업 + while (completedCount < progresses.length) { + if ( + progresses[completedCount] + speeds[completedCount] * currentDay < + 100 + ) + break; + completedCount++; + } + // 배포 + if (deployCount !== completedCount) { + answer.push(completedCount - deployCount); + deployCount = completedCount; + } + currentDay++; + } + + return answer; +} + +// ANCHOR - 2025.10.05 풀이 +function solution1(progresses, speeds) { let answer = []; let front = 0; // 현 시점 배포되어야 하는 작업 let day = 0; From bd595b24a414a9af4fc38decd9b62020d43585a8 Mon Sep 17 00:00:00 2001 From: yoouyeon Date: Thu, 4 Dec 2025 11:54:54 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=92=A1=20=ED=94=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=EB=A8=B8=EC=8A=A4=2042576=20-=20=EC=99=84=EC=A3=BC?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EB=AA=BB=ED=95=9C=20=EC=84=A0=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3\355\225\234_\354\204\240\354\210\230.js" | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git "a/Programmers/Level1/42576_\354\231\204\354\243\274\355\225\230\354\247\200_\353\252\273\355\225\234_\354\204\240\354\210\230.js" "b/Programmers/Level1/42576_\354\231\204\354\243\274\355\225\230\354\247\200_\353\252\273\355\225\234_\354\204\240\354\210\230.js" index bb6384b..7636d25 100644 --- "a/Programmers/Level1/42576_\354\231\204\354\243\274\355\225\230\354\247\200_\353\252\273\355\225\234_\354\204\240\354\210\230.js" +++ "b/Programmers/Level1/42576_\354\231\204\354\243\274\355\225\230\354\247\200_\353\252\273\355\225\234_\354\204\240\354\210\230.js" @@ -5,7 +5,33 @@ 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/42576 */ -function solution(participant, completion) { +// ANCHOR - 2025.12.04 풀이 +function solution2(participant, completion) { + // 참여자 맵 초기화 + const participantMap = new Map(); // key: 이름, value: 해당하는 선수 수 + for (const name of participant) { + if (participantMap.has(name)) { + participantMap.set(name, participantMap.get(name) + 1); + } else { + participantMap.set(name, 1); + } + } + + // 완주자 확인 + for (const name of completion) { + participantMap.set(name, participantMap.get(name) - 1); + } + + // 완주하지 못한 선수 학인 + for (const [name, count] of participantMap) { + if (count > 0) return name; + } + + return ""; // NEVER +} + +// ANCHOR - 2025.10.06 풀이 +function solution1(participant, completion) { // 1. completion으로 map 만들기 const map = new Map(); for (const person of completion) { From 0968596731a09f080f8f562a3cfcaf5a6748b65b Mon Sep 17 00:00:00 2001 From: yoouyeon Date: Thu, 4 Dec 2025 22:07:30 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=92=A1=20=ED=94=84=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=EB=A8=B8=EC=8A=A4=2042586=20-=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60\353\212\245\352\260\234\353\260\234.js" | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git "a/Programmers/Level2/42586_\352\270\260\353\212\245\352\260\234\353\260\234.js" "b/Programmers/Level2/42586_\352\270\260\353\212\245\352\260\234\353\260\234.js" index 61a7bbe..e8ba706 100644 --- "a/Programmers/Level2/42586_\352\270\260\353\212\245\352\260\234\353\260\234.js" +++ "b/Programmers/Level2/42586_\352\270\260\353\212\245\352\260\234\353\260\234.js" @@ -5,6 +5,35 @@ 링크 : https://school.programmers.co.kr/learn/courses/30/lessons/42586 */ +// ANCHOR - 2025.12.04 풀이 (리뷰 참고) +// https://github.com/yoouyeon/algorithm_study/pull/16#issuecomment-3610881111 +function solution2_1(progresses, speeds) { + // 각 작업이 완료되기까지 필요한 일 수 계산 + const daysNeeded = progresses.map((progress, index) => + Math.ceil((100 - progress) / speeds[index]) + ); + const answer = []; + let maxDay = daysNeeded[0]; + let count = 1; + + for (let idx = 1; idx < daysNeeded.length; idx++) { + if (daysNeeded[idx] <= maxDay) { + // 현재 작업이 앞선 작업보다 빨리 끝난다면 함께 배포 + count++; + } else { + // 새로운 배포 그룹 시작 + answer.push(count); + maxDay = daysNeeded[idx]; + count = 1; + } + } + + // 마지막 그룹 추가 + answer.push(count); + + return answer; +} + // ANCHOR - 2025.12.04 풀이 function solution2(progresses, speeds) { let answer = [];