From 88a0ea199a12764e5a2b17ca7a4fb6a6636c7d3c Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Tue, 27 Jan 2026 14:16:07 +0900 Subject: [PATCH 01/19] =?UTF-8?q?solve:=20=ED=81=90=20>=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=2015=20=EC=9A=94=EC=84=B8=ED=91=B8=EC=8A=A4=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...70\354\212\244\353\254\270\354\240\234.js" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "solutions/yesul/0127/[\353\254\270\354\240\23415]\354\232\224\354\204\270\355\221\270\354\212\244\353\254\270\354\240\234.js" diff --git "a/solutions/yesul/0127/[\353\254\270\354\240\23415]\354\232\224\354\204\270\355\221\270\354\212\244\353\254\270\354\240\234.js" "b/solutions/yesul/0127/[\353\254\270\354\240\23415]\354\232\224\354\204\270\355\221\270\354\212\244\353\254\270\354\240\234.js" new file mode 100644 index 0000000..5ebf399 --- /dev/null +++ "b/solutions/yesul/0127/[\353\254\270\354\240\23415]\354\232\224\354\204\270\355\221\270\354\212\244\353\254\270\354\240\234.js" @@ -0,0 +1,22 @@ +function solution(n, k) { + const answer = []; + // 모든 사람들을 배열에 넣음 + const queue = Array.from({ length: n }, (_, i) => i + 1); + + // queue의 길이가 0이 될 때까지 + while (queue.length > 0) { + for (let i = 0; i < k - 1; i++) { + // k-i 번쨰 사람들을 뒤로 보냄 + queue.push(queue.shift()); + } + + // k번쨰 사람을 제거 + answer.push(queue.shift()); + } + return answer; + +} + +console.log(solution(7, 3)); //[3, 6, 2, 7, 5, 1, 4] +console.log(solution(10, 3)); //[3, 6, 9, 2, 7, 1, 8, 5, 10, 4] +console.log(solution(10, 5)); //[5, 10, 6, 2, 9, 1, 8, 1, 4, 3 \ No newline at end of file From 701b6f018dc2a66823f09de1e686f6c8d44a8281 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Tue, 27 Jan 2026 14:16:14 +0900 Subject: [PATCH 02/19] =?UTF-8?q?solve:=20=ED=81=90=20>=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=2016=20=EA=B8=B0=EB=8A=A5=20=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" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "solutions/yesul/0127/[\353\254\270\354\240\23416]\352\270\260\353\212\245\352\260\234\353\260\234.js" diff --git "a/solutions/yesul/0127/[\353\254\270\354\240\23416]\352\270\260\353\212\245\352\260\234\353\260\234.js" "b/solutions/yesul/0127/[\353\254\270\354\240\23416]\352\270\260\353\212\245\352\260\234\353\260\234.js" new file mode 100644 index 0000000..f5c5944 --- /dev/null +++ "b/solutions/yesul/0127/[\353\254\270\354\240\23416]\352\270\260\353\212\245\352\260\234\353\260\234.js" @@ -0,0 +1,27 @@ +function solution(progresses, speeds) { + const answer = []; + + const availableDays = progresses.map((progress, index) => + Math.ceil((100 - progress) / speeds[index])); + + let maxDay = availableDays[0]; + let count = 0; + + for (let i = 0; i < availableDays.length; i++) { + // 기준일보다 빨리 끝났다면 같이 배포 + if (availableDays[i] <= maxDay) { + count++; + } else { + // 그게 아니라면 이전까지의 작업을 배포 + answer.push(count); + maxDay = availableDays[i]; + count = 1; + } + } + + answer.push(count); + return answer; +} + +console.log(solution([93, 30, 55], [1, 30, 5])); //[2, 1] +console.log(solution([95, 90, 99, 99, 80, 99], [1, 1, 1, 1, 1, 1])); //[1, 3, 2] \ No newline at end of file From 55edcd674b1a528fbe89e18b289ea30de0cb2c73 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Tue, 27 Jan 2026 14:16:23 +0900 Subject: [PATCH 03/19] =?UTF-8?q?solve:=20=ED=81=90=20>=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=2017=20=EC=B9=B4=EB=93=9C=EB=AD=89=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...64\353\223\234\353\255\211\354\271\230.js" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "solutions/yesul/0127/[\353\254\270\354\240\23417]\354\271\264\353\223\234\353\255\211\354\271\230.js" diff --git "a/solutions/yesul/0127/[\353\254\270\354\240\23417]\354\271\264\353\223\234\353\255\211\354\271\230.js" "b/solutions/yesul/0127/[\353\254\270\354\240\23417]\354\271\264\353\223\234\353\255\211\354\271\230.js" new file mode 100644 index 0000000..246bcfd --- /dev/null +++ "b/solutions/yesul/0127/[\353\254\270\354\240\23417]\354\271\264\353\223\234\353\255\211\354\271\230.js" @@ -0,0 +1,20 @@ +function solution(cards1, cards2, goal) { + const answer = []; + let index1 = 0; + let index2 = 0; + + for (const word of goal) { + if (cards1[index1] === word) { + index1++; + } else if (cards2[index2] === word) { + index2++; + } else { + return "No"; + } + } + + return 'Yes' +} + +console.log(solution(["i", "drink", "water"], ["want", "to"], ["i", "want", "to", "drink", "water"])); //"Yes" +console.log(solution(["i", "water", "drink"], ["want", "to"], ["i", "want", "to", "drink", "water"])); //"No" \ No newline at end of file From b61f43f9d063913a5056a3a32d433d562592070c Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Tue, 27 Jan 2026 14:20:51 +0900 Subject: [PATCH 04/19] =?UTF-8?q?solve:=20=ED=81=90=20>=20=ED=81=90=20?= =?UTF-8?q?=EB=A7=8C=EB=93=A4=EC=96=B4=EB=B3=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\226\264\353\263\264\352\270\260-1.js" | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 "solutions/yesul/0127/\355\201\220\353\247\214\353\223\244\354\226\264\353\263\264\352\270\260-1.js" diff --git "a/solutions/yesul/0127/\355\201\220\353\247\214\353\223\244\354\226\264\353\263\264\352\270\260-1.js" "b/solutions/yesul/0127/\355\201\220\353\247\214\353\223\244\354\226\264\353\263\264\352\270\260-1.js" new file mode 100644 index 0000000..a7d87a5 --- /dev/null +++ "b/solutions/yesul/0127/\355\201\220\353\247\214\353\223\244\354\226\264\353\263\264\352\270\260-1.js" @@ -0,0 +1,38 @@ +class Queue { + constructor() { + this.items = []; + } + + // 큐의 뒤에 데이터 삽입 + enqueue(item) { + this.items.push(item); + } + + // 큐의 앞에서 데이터 제거 + dequeue() { + this.items.shift(); + } + + // 맨 앞 요소 반환 + front() { + return this.items[0]; + } + + // 큐가 비어있는지 확인 + isEmpty() { + return this.items.length === 0; + } + + // 큐의 크기 반환 + size() { + return this.items.length; + } +} + +const queue = new Queue(); +queue.enqueue(1); +queue.enqueue(2); +queue.enqueue(3); +console.log(queue.front()); // 1 +console.log(queue.isEmpty()); // false +console.log(queue.size()); // 3 From abf8a1612c92a3799fbe8793787b4d4548c07909 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:18 +0900 Subject: [PATCH 05/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2018=20=EB=91=90=EA=B0=9C=EC=9D=B4=20?= =?UTF-8?q?=EC=88=98=EB=A1=9C=20=ED=8A=B9=EC=A0=95=EA=B0=92=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...260\222\353\247\214\353\223\244\352\270\260.js" | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23418]\353\221\220\352\260\234\354\235\230\354\210\230\353\241\234\355\212\271\354\240\225\352\260\222\353\247\214\353\223\244\352\270\260.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23418]\353\221\220\352\260\234\354\235\230\354\210\230\353\241\234\355\212\271\354\240\225\352\260\222\353\247\214\353\223\244\352\270\260.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23418]\353\221\220\352\260\234\354\235\230\354\210\230\353\241\234\355\212\271\354\240\225\352\260\222\353\247\214\353\223\244\352\270\260.js" new file mode 100644 index 0000000..f5bca35 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23418]\353\221\220\352\260\234\354\235\230\354\210\230\353\241\234\355\212\271\354\240\225\352\260\222\353\247\214\353\223\244\352\270\260.js" @@ -0,0 +1,14 @@ +function solution(arr, target) { + for (let i = 0; i < arr.length; i++) { + for (let j = i + 1; j < arr.length; j++) { + if (arr[i] + arr[j] === target) { + return true; ll + } + } + } + + return false; +} + +console.log(solution([1, 2, 3, 4, 8], 6)); // true +console.log(solution([2, 3, 5, 9], 10)); // false \ No newline at end of file From 7e13e9c6b0e07828a69db70a9b42da48fd8f0190 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:30 +0900 Subject: [PATCH 06/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2019=20=EB=AC=B8=EC=9E=90=EC=97=B4=20?= =?UTF-8?q?=ED=95=B4=EC=8B=B1=EC=9D=84=20=EC=9D=B4=EC=9A=A9=ED=95=9C=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=ED=95=A8=EC=88=98=20=EB=A7=8C=EB=93=A4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...11\355\225\250\354\210\230\353\247\214\353\223\244.js" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23419]\353\254\270\354\236\220\354\227\264\355\225\264\354\213\261\354\235\204\354\235\264\354\232\251\355\225\234\352\262\200\354\203\211\355\225\250\354\210\230\353\247\214\353\223\244.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23419]\353\254\270\354\236\220\354\227\264\355\225\264\354\213\261\354\235\204\354\235\264\354\232\251\355\225\234\352\262\200\354\203\211\355\225\250\354\210\230\353\247\214\353\223\244.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23419]\353\254\270\354\236\220\354\227\264\355\225\264\354\213\261\354\235\204\354\235\264\354\232\251\355\225\234\352\262\200\354\203\211\355\225\250\354\210\230\353\247\214\353\223\244.js" new file mode 100644 index 0000000..9c8de3a --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23419]\353\254\270\354\236\220\354\227\264\355\225\264\354\213\261\354\235\204\354\235\264\354\232\251\355\225\234\352\262\200\354\203\211\355\225\250\354\210\230\353\247\214\353\223\244.js" @@ -0,0 +1,8 @@ +// function solution(stringList, queryList) { +// return queryList.map((query) => stringList.includes(query)); +// } + +function solution(stringList, queryList) { +} + +console.log(solution(["apple", "banana", "charry"], ["banana", "kiwi", "melon", "apple"])); // [true, false, false, true] \ No newline at end of file From 38f2b3ddfddbe703bf2b9a55181a7ab76541cd2d Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:40 +0900 Subject: [PATCH 07/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2020=20=EC=99=84=EC=A3=BC=ED=95=98=EC=A7=80?= =?UTF-8?q?=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 --- ...\273\355\225\234\354\204\240\354\210\230.js" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23420]\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" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23420]\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/solutions/yesul/0128/[\353\254\270\354\240\23420]\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" new file mode 100644 index 0000000..97a0230 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23420]\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" @@ -0,0 +1,17 @@ +function solution(participant, completion) { + // 1. reduce로 참가자 명단 만들기 + const userHash = participant.reduce((obj, cur) => { + obj[cur] = (obj[cur] || 0) + 1; + return obj; // 다음 루프로 객체를 넘겨줌 + }, {}); + + // 2. 완주자 처리 + for (const name of completion) { + userHash[name]--; + } + + // 3. 결과 반환 + return Object.keys(userHash).find(key => userHash[key] > 0); +} + +console.log(solution(["leo", "kiki", "eden"], ["eden", "kiki"])); // "leo" \ No newline at end of file From 1509453b3dd2c0543dd54fed6888f3c54274f8bd Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:52 +0900 Subject: [PATCH 08/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2021=20=EC=98=81=EC=96=B4=20=EB=81=9D?= =?UTF-8?q?=EB=A7=90=EC=9E=87=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...35\353\247\220\354\236\207\352\270\260.js" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23421]\354\230\201\354\226\264\353\201\235\353\247\220\354\236\207\352\270\260.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23421]\354\230\201\354\226\264\353\201\235\353\247\220\354\236\207\352\270\260.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23421]\354\230\201\354\226\264\353\201\235\353\247\220\354\236\207\352\270\260.js" new file mode 100644 index 0000000..a3152d5 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23421]\354\230\201\354\226\264\353\201\235\353\247\220\354\236\207\352\270\260.js" @@ -0,0 +1,35 @@ +function solution(n, words) { + const answer = '' + + const usedWords = new Set(); + + const findIndex = words.findIndex((word, index) => { + if (index === 0) { + usedWords.add(word); + return false; + } + + const isWrong = words[index - 1].at(-1) !== word.at(0) + const isDuplicated = usedWords.has(word); + + if (isWrong || isDuplicated) { + return true; + } + + usedWords.add(word); + return false; + }); + + if (findIndex === -1) return [0, 0] + + + const userNum = (findIndex % n) + 1; + const wrongCountNum = Math.ceil((findIndex + 1) / n); + + + return [userNum, wrongCountNum]; +} + +console.log(solution(3, ["tank", "kick", "know", "wheel", "land", "dream", "mother", "robot", "tank"])); // [3,3] +console.log(solution(5, ["hello", "observe", "effect", "take", "either", "recognize", "encourage", "ensure", "establish", "hang", "gather", "refer", "reference", "estimate", "executive"])); // [0,0] +console.log(solution(2, ["hello", "one", "even", "never", "now", "world", "draw"])); // [1,3] \ No newline at end of file From c894f9de889c92f75593ce485c2f2292ce206a7f Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:59 +0900 Subject: [PATCH 09/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2022=20=EC=A0=84=ED=99=94=EB=B2=88=ED=98=B8?= =?UTF-8?q?=20=EB=AA=A9=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\262\210\355\230\270\353\252\251\353\241\235.js" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23422]\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23422]\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23422]\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.js" new file mode 100644 index 0000000..59bc6a9 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23422]\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.js" @@ -0,0 +1,13 @@ +function solution(phone_book) { + phone_book.sort(); + for (let i = 0; i < phone_book.length - 1; i++) { + if (phone_book[i + 1].startsWith(phone_book[i])) { + return false; + } + } + return true; +} + +console.log(solution(["119", "97674223", "1195524421"])); // false +console.log(solution(["123", "456", "789"])); // true +console.log(solution(["12", "123", "1235", "567", "88"])); // false \ No newline at end of file From cb56e69a399ca4f778912f71a84a48c8da8a6c27 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:36:06 +0900 Subject: [PATCH 10/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2023=20=ED=95=A0=EC=9D=B8=ED=96=89=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...40\354\235\270\355\226\211\354\202\254.js" | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23423]\355\225\240\354\235\270\355\226\211\354\202\254.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23423]\355\225\240\354\235\270\355\226\211\354\202\254.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23423]\355\225\240\354\235\270\355\226\211\354\202\254.js" new file mode 100644 index 0000000..8d88946 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23423]\355\225\240\354\235\270\355\226\211\354\202\254.js" @@ -0,0 +1,54 @@ +function solution(want, number, discount) { + let answer = 0; + + const wantMap = want.reduce((acc, cur, index) => { + acc[cur] = number[index]; + return acc; + }, {}); + + // 0일째 ~ 9일째 + // 마트 할인 기간이 끝나기 10일 전까지만 가입할 있기 때문에 + // discount.length - 10으로 제한 + for (let i = 0; i <= discount.length - 10; i++) { + // N일차의 할일 목록을 담을 객체 + const discountMap = {}; + + // 가입한 날 부터 10일동안 어떤 물품이 몇 개 있는지 + for (let j = i; j < i + 10; j++) { + const item = discount[j]; + discountMap[item] = (discountMap[item] || 0) + 1; + } + + // 사고 싶던 것과 개수가 일치하는지 확인 + if (isMatch(wantMap, discountMap)) { + answer++; // 성공횟수 추가 + } + } + + + function isMatch(wantMap, discountMap) { + for (const key in wantMap) { + if (discountMap[key] !== wantMap[key]) return false; + } + return true; + } + + return answer; +} + + + +console.log( + solution( + ["banana", "apple", "rice", "pork", "pot"], + [3, 2, 2, 2, 1], + ["chicken", "apple", "apple", "banana", "rice", "apple", "pork", "banana", "pork", "rice", "pot", "banana", "apple", "banana"] + ) +) // 3 + +console.log( + solution(["apple"], + [10], + ["banana", "banana", "banana", "banana", "banana", "banana", "banana", "banana", "banana", "banana"], + ) +) // 0 \ No newline at end of file From 4caf141a41c65d6de1ae24e22410d96db3515b07 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:18 +0900 Subject: [PATCH 11/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2018=20=EB=91=90=EA=B0=9C=EC=9D=B4=20?= =?UTF-8?q?=EC=88=98=EB=A1=9C=20=ED=8A=B9=EC=A0=95=EA=B0=92=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...260\222\353\247\214\353\223\244\352\270\260.js" | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23418]\353\221\220\352\260\234\354\235\230\354\210\230\353\241\234\355\212\271\354\240\225\352\260\222\353\247\214\353\223\244\352\270\260.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23418]\353\221\220\352\260\234\354\235\230\354\210\230\353\241\234\355\212\271\354\240\225\352\260\222\353\247\214\353\223\244\352\270\260.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23418]\353\221\220\352\260\234\354\235\230\354\210\230\353\241\234\355\212\271\354\240\225\352\260\222\353\247\214\353\223\244\352\270\260.js" new file mode 100644 index 0000000..f5bca35 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23418]\353\221\220\352\260\234\354\235\230\354\210\230\353\241\234\355\212\271\354\240\225\352\260\222\353\247\214\353\223\244\352\270\260.js" @@ -0,0 +1,14 @@ +function solution(arr, target) { + for (let i = 0; i < arr.length; i++) { + for (let j = i + 1; j < arr.length; j++) { + if (arr[i] + arr[j] === target) { + return true; ll + } + } + } + + return false; +} + +console.log(solution([1, 2, 3, 4, 8], 6)); // true +console.log(solution([2, 3, 5, 9], 10)); // false \ No newline at end of file From 8c7ea1545622bab9b3394aa83f4bcc857d314cb9 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:30 +0900 Subject: [PATCH 12/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2019=20=EB=AC=B8=EC=9E=90=EC=97=B4=20?= =?UTF-8?q?=ED=95=B4=EC=8B=B1=EC=9D=84=20=EC=9D=B4=EC=9A=A9=ED=95=9C=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=ED=95=A8=EC=88=98=20=EB=A7=8C=EB=93=A4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...11\355\225\250\354\210\230\353\247\214\353\223\244.js" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23419]\353\254\270\354\236\220\354\227\264\355\225\264\354\213\261\354\235\204\354\235\264\354\232\251\355\225\234\352\262\200\354\203\211\355\225\250\354\210\230\353\247\214\353\223\244.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23419]\353\254\270\354\236\220\354\227\264\355\225\264\354\213\261\354\235\204\354\235\264\354\232\251\355\225\234\352\262\200\354\203\211\355\225\250\354\210\230\353\247\214\353\223\244.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23419]\353\254\270\354\236\220\354\227\264\355\225\264\354\213\261\354\235\204\354\235\264\354\232\251\355\225\234\352\262\200\354\203\211\355\225\250\354\210\230\353\247\214\353\223\244.js" new file mode 100644 index 0000000..9c8de3a --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23419]\353\254\270\354\236\220\354\227\264\355\225\264\354\213\261\354\235\204\354\235\264\354\232\251\355\225\234\352\262\200\354\203\211\355\225\250\354\210\230\353\247\214\353\223\244.js" @@ -0,0 +1,8 @@ +// function solution(stringList, queryList) { +// return queryList.map((query) => stringList.includes(query)); +// } + +function solution(stringList, queryList) { +} + +console.log(solution(["apple", "banana", "charry"], ["banana", "kiwi", "melon", "apple"])); // [true, false, false, true] \ No newline at end of file From b13e49da6a54d4d8e343b358c7f0563f9b29a07e Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:40 +0900 Subject: [PATCH 13/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2020=20=EC=99=84=EC=A3=BC=ED=95=98=EC=A7=80?= =?UTF-8?q?=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 --- ...\273\355\225\234\354\204\240\354\210\230.js" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23420]\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" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23420]\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/solutions/yesul/0128/[\353\254\270\354\240\23420]\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" new file mode 100644 index 0000000..97a0230 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23420]\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" @@ -0,0 +1,17 @@ +function solution(participant, completion) { + // 1. reduce로 참가자 명단 만들기 + const userHash = participant.reduce((obj, cur) => { + obj[cur] = (obj[cur] || 0) + 1; + return obj; // 다음 루프로 객체를 넘겨줌 + }, {}); + + // 2. 완주자 처리 + for (const name of completion) { + userHash[name]--; + } + + // 3. 결과 반환 + return Object.keys(userHash).find(key => userHash[key] > 0); +} + +console.log(solution(["leo", "kiki", "eden"], ["eden", "kiki"])); // "leo" \ No newline at end of file From 316f30078575cd773f7ffe1db2a9495437ea09a9 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:52 +0900 Subject: [PATCH 14/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2021=20=EC=98=81=EC=96=B4=20=EB=81=9D?= =?UTF-8?q?=EB=A7=90=EC=9E=87=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...35\353\247\220\354\236\207\352\270\260.js" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23421]\354\230\201\354\226\264\353\201\235\353\247\220\354\236\207\352\270\260.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23421]\354\230\201\354\226\264\353\201\235\353\247\220\354\236\207\352\270\260.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23421]\354\230\201\354\226\264\353\201\235\353\247\220\354\236\207\352\270\260.js" new file mode 100644 index 0000000..a3152d5 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23421]\354\230\201\354\226\264\353\201\235\353\247\220\354\236\207\352\270\260.js" @@ -0,0 +1,35 @@ +function solution(n, words) { + const answer = '' + + const usedWords = new Set(); + + const findIndex = words.findIndex((word, index) => { + if (index === 0) { + usedWords.add(word); + return false; + } + + const isWrong = words[index - 1].at(-1) !== word.at(0) + const isDuplicated = usedWords.has(word); + + if (isWrong || isDuplicated) { + return true; + } + + usedWords.add(word); + return false; + }); + + if (findIndex === -1) return [0, 0] + + + const userNum = (findIndex % n) + 1; + const wrongCountNum = Math.ceil((findIndex + 1) / n); + + + return [userNum, wrongCountNum]; +} + +console.log(solution(3, ["tank", "kick", "know", "wheel", "land", "dream", "mother", "robot", "tank"])); // [3,3] +console.log(solution(5, ["hello", "observe", "effect", "take", "either", "recognize", "encourage", "ensure", "establish", "hang", "gather", "refer", "reference", "estimate", "executive"])); // [0,0] +console.log(solution(2, ["hello", "one", "even", "never", "now", "world", "draw"])); // [1,3] \ No newline at end of file From 9dc61aa6f534ff0721e1585c2fe498859652afcb Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:35:59 +0900 Subject: [PATCH 15/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2022=20=EC=A0=84=ED=99=94=EB=B2=88=ED=98=B8?= =?UTF-8?q?=20=EB=AA=A9=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\262\210\355\230\270\353\252\251\353\241\235.js" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23422]\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23422]\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23422]\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.js" new file mode 100644 index 0000000..59bc6a9 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23422]\354\240\204\355\231\224\353\262\210\355\230\270\353\252\251\353\241\235.js" @@ -0,0 +1,13 @@ +function solution(phone_book) { + phone_book.sort(); + for (let i = 0; i < phone_book.length - 1; i++) { + if (phone_book[i + 1].startsWith(phone_book[i])) { + return false; + } + } + return true; +} + +console.log(solution(["119", "97674223", "1195524421"])); // false +console.log(solution(["123", "456", "789"])); // true +console.log(solution(["12", "123", "1235", "567", "88"])); // false \ No newline at end of file From c8b2d9d0f0add4072c1533777f127c4bcddfe691 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Wed, 28 Jan 2026 14:36:06 +0900 Subject: [PATCH 16/19] =?UTF-8?q?solve:=20=ED=95=B4=EC=8B=9C=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2023=20=ED=95=A0=EC=9D=B8=ED=96=89=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...40\354\235\270\355\226\211\354\202\254.js" | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 "solutions/yesul/0128/[\353\254\270\354\240\23423]\355\225\240\354\235\270\355\226\211\354\202\254.js" diff --git "a/solutions/yesul/0128/[\353\254\270\354\240\23423]\355\225\240\354\235\270\355\226\211\354\202\254.js" "b/solutions/yesul/0128/[\353\254\270\354\240\23423]\355\225\240\354\235\270\355\226\211\354\202\254.js" new file mode 100644 index 0000000..8d88946 --- /dev/null +++ "b/solutions/yesul/0128/[\353\254\270\354\240\23423]\355\225\240\354\235\270\355\226\211\354\202\254.js" @@ -0,0 +1,54 @@ +function solution(want, number, discount) { + let answer = 0; + + const wantMap = want.reduce((acc, cur, index) => { + acc[cur] = number[index]; + return acc; + }, {}); + + // 0일째 ~ 9일째 + // 마트 할인 기간이 끝나기 10일 전까지만 가입할 있기 때문에 + // discount.length - 10으로 제한 + for (let i = 0; i <= discount.length - 10; i++) { + // N일차의 할일 목록을 담을 객체 + const discountMap = {}; + + // 가입한 날 부터 10일동안 어떤 물품이 몇 개 있는지 + for (let j = i; j < i + 10; j++) { + const item = discount[j]; + discountMap[item] = (discountMap[item] || 0) + 1; + } + + // 사고 싶던 것과 개수가 일치하는지 확인 + if (isMatch(wantMap, discountMap)) { + answer++; // 성공횟수 추가 + } + } + + + function isMatch(wantMap, discountMap) { + for (const key in wantMap) { + if (discountMap[key] !== wantMap[key]) return false; + } + return true; + } + + return answer; +} + + + +console.log( + solution( + ["banana", "apple", "rice", "pork", "pot"], + [3, 2, 2, 2, 1], + ["chicken", "apple", "apple", "banana", "rice", "apple", "pork", "banana", "pork", "rice", "pot", "banana", "apple", "banana"] + ) +) // 3 + +console.log( + solution(["apple"], + [10], + ["banana", "banana", "banana", "banana", "banana", "banana", "banana", "banana", "banana", "banana"], + ) +) // 0 \ No newline at end of file From 753c70baf48b31e38121fcfe577b2e59ed8a90f0 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Tue, 3 Feb 2026 16:04:10 +0900 Subject: [PATCH 17/19] =?UTF-8?q?solve:=20=EC=A7=91=ED=95=A9=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2033=20=EA=B0=84=EB=8B=A8=ED=95=9C=20?= =?UTF-8?q?=EC=9C=A0=EB=8B=88=EC=98=A8=20=ED=8C=8C=EC=9D=B8=EB=93=9C=20?= =?UTF-8?q?=EC=95=8C=EA=B3=A0=EB=A6=AC=EC=A6=98=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...54\355\230\204\355\225\230\352\270\260.js" | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 "solutions/yesul/0203/[\353\254\270\354\240\23433]\352\260\204\353\213\250\355\225\234\354\234\240\353\213\210\354\230\250\355\214\214\354\235\270\353\223\234\354\225\214\352\263\240\353\246\254\354\246\230\352\265\254\355\230\204\355\225\230\352\270\260.js" diff --git "a/solutions/yesul/0203/[\353\254\270\354\240\23433]\352\260\204\353\213\250\355\225\234\354\234\240\353\213\210\354\230\250\355\214\214\354\235\270\353\223\234\354\225\214\352\263\240\353\246\254\354\246\230\352\265\254\355\230\204\355\225\230\352\270\260.js" "b/solutions/yesul/0203/[\353\254\270\354\240\23433]\352\260\204\353\213\250\355\225\234\354\234\240\353\213\210\354\230\250\355\214\214\354\235\270\353\223\234\354\225\214\352\263\240\353\246\254\354\246\230\352\265\254\355\230\204\355\225\230\352\270\260.js" new file mode 100644 index 0000000..3a6af31 --- /dev/null +++ "b/solutions/yesul/0203/[\353\254\270\354\240\23433]\352\260\204\353\213\250\355\225\234\354\234\240\353\213\210\354\230\250\355\214\214\354\235\270\353\223\234\354\225\214\352\263\240\353\246\254\354\246\230\352\265\254\355\230\204\355\225\230\352\270\260.js" @@ -0,0 +1,39 @@ +function solution(k, operations) { + const parent = Array.from({ length: k }, (_, index) => index); + + function find(x) { + if (parent[x] === x) { + return x; + } + + return parent[x] = find(parent[x]); + } + + function union(x, y) { + const rootX = find(x); + const rootY = find(y); + + if (rootX !== rootY) { + if (rootY < rootX) { + parent[rootX] = rootY; + } else { + parent[rootY] = rootX; + } + } + } + + for (const [operation, ...args] of operations) { + if (operation === 'u') { + union(...args); + } else if (operation === 'f') { + find(...args); + } + } + + // 집합의 개수 세기 + return parent.filter((val, idx) => val === idx).length; + +} + +console.log(solution(3, [['u', 0, 1], ['u', 1, 2], ['f', 2]])) // 1 +console.log(solution(4, [['u', 0, 1], ['u', 2, 3], ['f', 0]])) // 2 From 597010d2426ae6313c878668c6fc19fdf1283070 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Tue, 3 Feb 2026 16:04:19 +0900 Subject: [PATCH 18/19] =?UTF-8?q?solve:=20=EC=A7=91=ED=95=A9=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2034=20=ED=8F=B0=EC=BC=93=EB=AA=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\240\23434]\355\217\260\354\274\223\353\252\254.js" | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 "solutions/yesul/0203/[\353\254\270\354\240\23434]\355\217\260\354\274\223\353\252\254.js" diff --git "a/solutions/yesul/0203/[\353\254\270\354\240\23434]\355\217\260\354\274\223\353\252\254.js" "b/solutions/yesul/0203/[\353\254\270\354\240\23434]\355\217\260\354\274\223\353\252\254.js" new file mode 100644 index 0000000..030c257 --- /dev/null +++ "b/solutions/yesul/0203/[\353\254\270\354\240\23434]\355\217\260\354\274\223\353\252\254.js" @@ -0,0 +1,10 @@ +function solution(nums) { + const max = nums.length / 2; + const types = new Set(nums); + + return Math.min(types.size, max); +} + +console.log(solution([3, 1, 2, 3])) // 2 +console.log(solution([3, 3, 3, 2, 2, 4])) // 3 +console.log(solution([3, 3, 3, 2, 2, 2])) // 2 \ No newline at end of file From 5f3d78b2ef89bbf0af77ea4381bc3fb4eb185f13 Mon Sep 17 00:00:00 2001 From: Leemainsw Date: Tue, 3 Feb 2026 16:04:30 +0900 Subject: [PATCH 19/19] =?UTF-8?q?solve:=20=EC=A7=91=ED=95=A9=20>=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=2035=20=EC=84=AC=20=EC=97=B0=EA=B2=B0?= =?UTF-8?q?=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60\352\262\260\355\225\230\352\270\260.js" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "solutions/yesul/0203/[\353\254\270\354\240\23435]\354\204\254\354\227\260\352\262\260\355\225\230\352\270\260.js" diff --git "a/solutions/yesul/0203/[\353\254\270\354\240\23435]\354\204\254\354\227\260\352\262\260\355\225\230\352\270\260.js" "b/solutions/yesul/0203/[\353\254\270\354\240\23435]\354\204\254\354\227\260\352\262\260\355\225\230\352\270\260.js" new file mode 100644 index 0000000..02f39c7 --- /dev/null +++ "b/solutions/yesul/0203/[\353\254\270\354\240\23435]\354\204\254\354\227\260\352\262\260\355\225\230\352\270\260.js" @@ -0,0 +1,35 @@ +function solution(n, costs) { + const parent = Array.from({ length: n }, (_, i) => i); + + function find(x) { + if (parent[x] === x) { + return x; + } + + return parent[x] = find(parent[x]); + } + + function union(x, y) { + const rootX = find(x); + const rootY = find(y); + if (rootX !== rootY) { + parent[rootY] = rootX; + return true; + } + return false; + + } + + // 가장 적은 다리 건설 비용 + costs.sort((a, b) => a[2] - b[2]); + + let total = 0; + + for (const [from, to, cost] of costs) { + if (union(from, to)) { + total += cost; + } + } + + return total; +} \ No newline at end of file