From 3e41d0c9ce71cd6bbf4ef73aae37163eef8dd8c1 Mon Sep 17 00:00:00 2001 From: haileyport Date: Tue, 29 Nov 2022 18:38:51 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[PGS]=20=EC=99=84=EC=A3=BC=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EB=AA=BB=ED=95=9C=20=EC=84=A0=EC=88=98=20/=20LV1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... \353\252\273\355\225\234 \354\204\240\354\210\230.js" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "\354\243\274\354\244\2218B/eunhye/week05/\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/\354\243\274\354\244\2218B/eunhye/week05/\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/\354\243\274\354\244\2218B/eunhye/week05/\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 00000000..2870e1b4 --- /dev/null +++ "b/\354\243\274\354\244\2218B/eunhye/week05/\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,8 @@ +function solution(participant, completion) { + completion.sort(); + participant.sort(); + + return participant.filter((el, idx) => { + if(completion[idx] !== el) return el; + })[0] +} \ No newline at end of file From 17efbd2fefe08f7128881a804dc33df60ed9dc15 Mon Sep 17 00:00:00 2001 From: haileyport Date: Tue, 29 Nov 2022 18:39:01 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[PGS]=20=ED=91=B8=EB=93=9C=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20=EB=8C=80=ED=9A=8C=20/=20LV1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...35\264\355\212\270 \353\214\200\355\232\214.js" | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 "\354\243\274\354\244\2218B/eunhye/week05/\355\221\270\353\223\234 \355\214\214\354\235\264\355\212\270 \353\214\200\355\232\214.js" diff --git "a/\354\243\274\354\244\2218B/eunhye/week05/\355\221\270\353\223\234 \355\214\214\354\235\264\355\212\270 \353\214\200\355\232\214.js" "b/\354\243\274\354\244\2218B/eunhye/week05/\355\221\270\353\223\234 \355\214\214\354\235\264\355\212\270 \353\214\200\355\232\214.js" new file mode 100644 index 00000000..0e33bf37 --- /dev/null +++ "b/\354\243\274\354\244\2218B/eunhye/week05/\355\221\270\353\223\234 \355\214\214\354\235\264\355\212\270 \353\214\200\355\232\214.js" @@ -0,0 +1,14 @@ +function solution(food) { + // 왼쪽부터 만들어서 0넣고 뒤집기 + // 음식 종류와 양이 같아야 해서 1개 갖고 오면 못 먹음 + const arr = []; + + food.forEach((el, idx) => { + if(el >= 2) { + const eat = Math.floor(el/2); + // repeat은 ... number type에 안 먹는다... + arr.push(String(idx).repeat(eat)); + } + }) + return arr.join('') + 0 + arr.reverse().join(''); +} \ No newline at end of file From 60de14207fbfb10cb4f453ba6c90f8fe28e06e46 Mon Sep 17 00:00:00 2001 From: haileyport Date: Tue, 29 Nov 2022 18:39:08 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[PGS]=20=EC=B9=B4=ED=8E=AB=20/=20LV2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eunhye/week05/\354\271\264\355\216\253.js" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "\354\243\274\354\244\2218B/eunhye/week05/\354\271\264\355\216\253.js" diff --git "a/\354\243\274\354\244\2218B/eunhye/week05/\354\271\264\355\216\253.js" "b/\354\243\274\354\244\2218B/eunhye/week05/\354\271\264\355\216\253.js" new file mode 100644 index 00000000..db2289ca --- /dev/null +++ "b/\354\243\274\354\244\2218B/eunhye/week05/\354\271\264\355\216\253.js" @@ -0,0 +1,13 @@ +function solution(brown, yellow) { + const box = brown + yellow; + const mid = Math.floor(box/2); + for(let i=mid; i>0; i--) { + if(box%i !== 0) continue; + + const w = i; + const h = box / i; + if((w-2) * (h-2) === yellow){ + return [w, h] + } + } +} \ No newline at end of file From cc585f4bf725982434db5effde815cd2aa27aadc Mon Sep 17 00:00:00 2001 From: haileyport Date: Tue, 29 Nov 2022 18:39:18 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[PGS]=20=EC=98=81=EC=96=B4=20=EB=81=9D?= =?UTF-8?q?=EB=A7=90=EC=9E=87=EA=B8=B0=20/=20LV2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1\235\353\247\220\354\236\207\352\270\260.js" | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 "\354\243\274\354\244\2218B/eunhye/week05/\354\230\201\354\226\264 \353\201\235\353\247\220\354\236\207\352\270\260.js" diff --git "a/\354\243\274\354\244\2218B/eunhye/week05/\354\230\201\354\226\264 \353\201\235\353\247\220\354\236\207\352\270\260.js" "b/\354\243\274\354\244\2218B/eunhye/week05/\354\230\201\354\226\264 \353\201\235\353\247\220\354\236\207\352\270\260.js" new file mode 100644 index 00000000..871ed92c --- /dev/null +++ "b/\354\243\274\354\244\2218B/eunhye/week05/\354\230\201\354\226\264 \353\201\235\353\247\220\354\236\207\352\270\260.js" @@ -0,0 +1,16 @@ +function solution(n, words) { + let arr = []; + for (let i = 0; i < words.length; i++) { + if (i === 0) arr.push(words[i]); + else if ( + !arr.includes(words[i]) && + words[i - 1][words[i - 1].length - 1] === words[i][0] + ) { + arr.push(words[i]); + } else { + return [(i % n) + 1, parseInt(i / n) + 1]; + } + } + + return [0, 0]; + } \ No newline at end of file