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 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 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 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