From 4a9c701f3f55cb41faadd4344b68ac605049b124 Mon Sep 17 00:00:00 2001 From: hyungchunKim <131167225+hyungchunKim@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:38:16 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[=ED=98=95=EC=A4=80]=2012914=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../12914_\352\271\200\355\230\225\354\244\200.js" | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 "5\354\243\274\354\260\250/12914/12914_\352\271\200\355\230\225\354\244\200.js" diff --git "a/5\354\243\274\354\260\250/12914/12914_\352\271\200\355\230\225\354\244\200.js" "b/5\354\243\274\354\260\250/12914/12914_\352\271\200\355\230\225\354\244\200.js" new file mode 100644 index 0000000..59d3e1b --- /dev/null +++ "b/5\354\243\274\354\260\250/12914/12914_\352\271\200\355\230\225\354\244\200.js" @@ -0,0 +1,11 @@ +function solution(n) { + let answer = 0; + let sol1 = 0; + let sol2 = 1; + for(let i = 2 ; i <= n + 1 ; i++) { + answer = sol1 + sol2 % 1234567; + sol1 = sol2; + sol2 = answer; + } + return answer % 1234567; +} \ No newline at end of file From b4849c0fa646eb26602033ecb145d3589fa22d92 Mon Sep 17 00:00:00 2001 From: hyungchunKim <131167225+hyungchunKim@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:40:48 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[=ED=98=95=EC=A4=80]=20131127=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7_\352\271\200\355\230\225\354\244\200.js" | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "5\354\243\274\354\260\250/131127/131127_\352\271\200\355\230\225\354\244\200.js" diff --git "a/5\354\243\274\354\260\250/131127/131127_\352\271\200\355\230\225\354\244\200.js" "b/5\354\243\274\354\260\250/131127/131127_\352\271\200\355\230\225\354\244\200.js" new file mode 100644 index 0000000..afb90b7 --- /dev/null +++ "b/5\354\243\274\354\260\250/131127/131127_\352\271\200\355\230\225\354\244\200.js" @@ -0,0 +1,21 @@ +function solution(want, number, discount) { + let cnt = 0; + let cntArr = new Array(number.length).fill(0); + + const equals = (a, b) => JSON.stringify(a) === JSON.stringify(b); + + for (let i = 0; i < discount.length; i++) { + let thing = discount[i]; + + if (want.includes(thing)) { + cntArr[want.indexOf(thing)]++; + } + + if (i >= 9) { + if (want.includes(discount[i - 10])) + cntArr[want.indexOf(discount[i - 10])]--; + if (equals(number, cntArr)) cnt++; + } + } + return cnt; +} \ No newline at end of file From 4444179d0f2eb68abf0447884b9ec55d3a1b2666 Mon Sep 17 00:00:00 2001 From: hyungchunKim <131167225+hyungchunKim@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:43:08 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[=ED=98=95=EC=A4=80]=2017680=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0_\352\271\200\355\230\225\354\244\200.js" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "5\354\243\274\354\260\250/17680/17680_\352\271\200\355\230\225\354\244\200.js" diff --git "a/5\354\243\274\354\260\250/17680/17680_\352\271\200\355\230\225\354\244\200.js" "b/5\354\243\274\354\260\250/17680/17680_\352\271\200\355\230\225\354\244\200.js" new file mode 100644 index 0000000..94ec308 --- /dev/null +++ "b/5\354\243\274\354\260\250/17680/17680_\352\271\200\355\230\225\354\244\200.js" @@ -0,0 +1,27 @@ +function solution(cacheSize, cities) { + const cache = []; + let time = 0; + + if (!cacheSize) return cities.length * 5; + + for (let city of cities) { + let upperCase = city.toUpperCase(); + if (cache.includes(upperCase)) { + time += 1; + cache.splice(cache.indexOf(upperCase), 1); + cache.push(upperCase); + continue; + } + + if (cache.length === cacheSize) { + cache.shift(); + cache.push(upperCase); + time += 5; + continue; + } + + cache.push(upperCase); + time += 5; + } + return time; +} \ No newline at end of file