diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\352\260\200\354\232\264\353\215\260\352\270\200\354\236\220\352\260\200\354\240\270\354\230\244\352\270\260.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\352\260\200\354\232\264\353\215\260\352\270\200\354\236\220\352\260\200\354\240\270\354\230\244\352\270\260.js" new file mode 100644 index 00000000..3c69d87d --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\352\260\200\354\232\264\353\215\260\352\270\200\354\236\220\352\260\200\354\240\270\354\230\244\352\270\260.js" @@ -0,0 +1,7 @@ +function solution(s) { + if(s.length % 2 === 0) { + return s[s.length / 2 - 1] + s[s.length / 2] + } else { + return s[parseInt(s.length / 2)] + } +} \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\353\202\264\354\240\201.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\353\202\264\354\240\201.js" new file mode 100644 index 00000000..2599867a --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\353\202\264\354\240\201.js" @@ -0,0 +1,7 @@ +function solution(a, b) { + let answer = 0; + for(let i = 0; i < a.length; i++) { + answer = answer + a[i] * b[i] + } + return answer; +} \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\353\254\270\354\236\220\354\227\264\353\202\264\353\246\274\354\260\250\354\210\234\354\234\274\353\241\234\353\260\260\354\271\230\355\225\230\352\270\260.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\353\254\270\354\236\220\354\227\264\353\202\264\353\246\274\354\260\250\354\210\234\354\234\274\353\241\234\353\260\260\354\271\230\355\225\230\352\270\260.js" new file mode 100644 index 00000000..e311675d --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\353\254\270\354\236\220\354\227\264\353\202\264\353\246\274\354\260\250\354\210\234\354\234\274\353\241\234\353\260\260\354\271\230\355\225\230\352\270\260.js" @@ -0,0 +1,4 @@ +function solution(s) { + let arr = s.split('') + return arr.sort().reverse().join('') +} \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\210\230\353\260\225\354\210\230\353\260\225\354\210\230\353\260\225.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\210\230\353\260\225\354\210\230\353\260\225\354\210\230\353\260\225.js" new file mode 100644 index 00000000..6a8d77aa --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\210\230\353\260\225\354\210\230\353\260\225\354\210\230\353\260\225.js" @@ -0,0 +1,7 @@ +function solution(n) { + if (n % 2 === 0) { + return '수박'.repeat(n / 2); + } else { + return '수박'.repeat(Math.floor(n / 2)) + '수' + } +} \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\227\206\353\212\224\354\210\253\354\236\220\353\215\224\355\225\230\352\270\260.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\227\206\353\212\224\354\210\253\354\236\220\353\215\224\355\225\230\352\270\260.js" new file mode 100644 index 00000000..7a37ae12 --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\227\206\353\212\224\354\210\253\354\236\220\353\215\224\355\225\230\352\270\260.js" @@ -0,0 +1,8 @@ +function solution(numbers) { + const zeroToNine = [0,1,2,3,4,5,6,7,8,9] + let filteredArr = zeroToNine.filter((el) => { + return !numbers.includes(el); + }) + + return filteredArr.reduce((acc, cur) => acc + cur, 0); +} \ No newline at end of file diff --git "a/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\235\214\354\226\221\353\215\224\355\225\230\352\270\260.js" "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\235\214\354\226\221\353\215\224\355\225\230\352\270\260.js" new file mode 100644 index 00000000..ab6e4201 --- /dev/null +++ "b/\354\210\230\354\232\224\354\235\274/Kyusik/week4/\354\235\214\354\226\221\353\215\224\355\225\230\352\270\260.js" @@ -0,0 +1,10 @@ +function solution(absolutes, signs) { + + const pm = signs.map((el) => { + return (el === true ? 1 : -1) + }) + + return absolutes.reduce((acc, cur, idx) => { + return acc + cur * pm[idx] + }, 0); +} \ No newline at end of file