diff --git "a/level-1/\353\202\230\353\250\270\354\247\200\352\260\200-1\354\235\264-\353\220\230\353\212\224-\354\210\230-\354\260\276\352\270\260.js" "b/level-1/\353\202\230\353\250\270\354\247\200\352\260\200-1\354\235\264-\353\220\230\353\212\224-\354\210\230-\354\260\276\352\270\260.js" index e06c4fb..a9cdda5 100644 --- "a/level-1/\353\202\230\353\250\270\354\247\200\352\260\200-1\354\235\264-\353\220\230\353\212\224-\354\210\230-\354\260\276\352\270\260.js" +++ "b/level-1/\353\202\230\353\250\270\354\247\200\352\260\200-1\354\235\264-\353\220\230\353\212\224-\354\210\230-\354\260\276\352\270\260.js" @@ -21,4 +21,14 @@ function solution(n) { i++; } return answer; -} \ No newline at end of file +} + +//정답 3 - jaewon1676 +function solution(n) { + var answer = 0; + for (let i=1; i (a < b ? 1 : -1)).join(""); } -//정답4 - prove-ability +//정답 4 - prove-ability function solution(s) { return s.split("").sort().reverse().join("") } + +//정답 5 - jaewon1676 +function solution(s) { + return s.split('').sort().reverse().join('') +} +// split('')은 문자열을 하나씩 쪼개주면서 타입을 배열로 변환시켜줍니다. +// 그러면 문자열 타입이 배열이 되므로 정렬을 할 수 있습니다. +// sort()는 오름차순이기때문에 다시 뒤집어서 합쳐줍니다. diff --git "a/level-1/\353\254\270\354\236\220\354\227\264\354\235\204-\354\240\225\354\210\230\353\241\234-\353\260\224\352\276\270\352\270\260.js" "b/level-1/\353\254\270\354\236\220\354\227\264\354\235\204-\354\240\225\354\210\230\353\241\234-\353\260\224\352\276\270\352\270\260.js" index fda722f..0f6cd9b 100644 --- "a/level-1/\353\254\270\354\236\220\354\227\264\354\235\204-\354\240\225\354\210\230\353\241\234-\353\260\224\352\276\270\352\270\260.js" +++ "b/level-1/\353\254\270\354\236\220\354\227\264\354\235\204-\354\240\225\354\210\230\353\241\234-\353\260\224\352\276\270\352\270\260.js" @@ -15,4 +15,9 @@ function solution(s) { //정답 3 - prove-ability function solution(s) { return parseInt(s, 10); +} + +//정답 4 - jaewon1676 +function solution(s) { + return parseInt(s); } \ No newline at end of file diff --git "a/level-1/\354\204\234\354\232\270\354\227\220\354\204\234-\352\271\200\354\204\234\353\260\251-\354\260\276\352\270\260.js" "b/level-1/\354\204\234\354\232\270\354\227\220\354\204\234-\352\271\200\354\204\234\353\260\251-\354\260\276\352\270\260.js" index 881e45e..ad9399d 100644 --- "a/level-1/\354\204\234\354\232\270\354\227\220\354\204\234-\352\271\200\354\204\234\353\260\251-\354\260\276\352\270\260.js" +++ "b/level-1/\354\204\234\354\232\270\354\227\220\354\204\234-\352\271\200\354\204\234\353\260\251-\354\260\276\352\270\260.js" @@ -15,4 +15,13 @@ function solution(seoul) { //정답 3 - prove-ability function solution(seoul) { return `김서방은 ${seoul.findIndex(v => v === "Kim")}에 있다`; +} + +//정답 4 - jaewon1676 +function solution(seoul) { + var answer = ''; + for (let i=0; i<1000; i++){ + if (seoul[i] === 'Kim') return '김서방은 ' + i + '에 있다'; + } + return 1; } \ No newline at end of file diff --git "a/level-1/\354\230\210\354\202\260.js" "b/level-1/\354\230\210\354\202\260.js" index ed46312..2b914fe 100644 --- "a/level-1/\354\230\210\354\202\260.js" +++ "b/level-1/\354\230\210\354\202\260.js" @@ -28,3 +28,20 @@ function solution(d, budget) { return count; } + +//정답 3 - jaewon1676 +function solution(d, budget) { + let count = 0; // 최대 물품 지원 할 수 있는 부서 수 + d.sort((a, b) => a - b) // 오름차순 정렬 + for (let i=0; i