Jayden`s
[JS] ์นด์นด์ค2022 - ์ ๊ณ ๊ฒฐ๊ณผ ๋ฐ๊ธฐ
function solution(id_list, report, k) { // id_list์ ๊ฐ ์ ์ ๋ฅผ key, []๋ฅผ value๋ก ๊ฐ๋ ๊ฐ์ฒด๋ฅผ ๋ง๋ ๋ค. // report์ ๊ฐ๋ค์ ๋ํด splitํ๊ณ 0๋ฒ์งธ ์์๋ฅผ key๋ก ๊ฐ์ง ๋ ์์ ๊ฐ์ฒด์ value์ 1๋ฒ์งธ ์์๋ฅผ pushํ๋ค. let reportList = {}; for (let id of id_list) { reportList[id] = []; } // ์ ๊ณ ๊ธฐ๋ก์ [์ ๊ณ ํ ์ ์ , ์ ๊ณ ๋ฐ์ ์ ์ ]๋ก splitํ๊ณ ๊ฐ๊ฐ์ reportList ๊ฐ์ฒด์ key๊ฐ๊ณผ value์ ๋ฐฐ์ด์ ์ถ๊ฐํ๋ค. for (let value of report) { let [reporting, reported] = value.split(' '); if (reportList[..
[JS] 2021์นด์นด์ค - ๋ก๋์ ์ต๊ณ ์์์ ์ต์ ์์
function solution(lottos, win_nums) { let best = 0; let worst = 0; for (let i = 0; i = 2 ? 7 - best : 6, worst >= 2 ? 7 - worst : 6]; } ํ๋ก๊ทธ๋๋จธ์ค ์ฝ๋ฉํ ์คํธ ์ฐ์ต - ๋ก๋์ ์ต๊ณ ์์์ ์ต์ ์์ ๋ก๋ 6/45(์ดํ '๋ก๋'๋ก ํ๊ธฐ)๋ 1๋ถํฐ 45๊น์ง์ ์ซ์ ์ค 6๊ฐ๋ฅผ ์ฐ์ด์ ๋งํ๋ ๋ํ์ ์ธ ๋ณต๊ถ์ ๋๋ค. ์๋๋ ๋ก๋์ ์์๋ฅผ ์ ํ๋ ๋ฐฉ์์ ๋๋ค. 1 ์..
![220701(๊ธ) ์คํํธ์](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FVV6tF%2FbtrGaqSqru8%2FgKnMXBnP6BnuznR2GdKKR0%2Fimg.png)
220701(๊ธ) ์คํํธ์
์ฐ์ฃผ ์ฐ์ ์คํํธ์ ์์ฒด์ ๊ด์ฌ์ ์์ง๋ง, ๊ฐ ์ฐ์ ๊ตฐ ๋ณ๋ก ์ฌ์ ํ๊ฐ ๋๊ธฐ๊น์ง์ ์๊ฐ์ ๋ฌ๋ฆฌํด์ ์ ๋ถ์ ์ง์์ด ์์ด์ผํ๋ค๋ ๋ง์ ๊ณต๊ฐํ๋ค. ํนํ๋ ์คํํธ์ ๊ณผ ๊ฐ์ด ๊ท๋ชจ๊ฐ ์์์๋ก ์ํด์๋ ์ฐ์ ๊ตฐ์ ๋ฐ๋ผ ์์ ๋ค๋ฅธ ๋ฐฉํฅ์ ๊ฐ๊ฒ ๋๊ธฐ ๋๋ฌธ์ด๋ค.
[JS] 2021์นด์นด์ค - ์ ๊ท ์์ด๋ ์ถ์ฒ
function solution(new_id) { const recommendationId = (id) => { // 1๋จ๊ณ. ๋๋ฌธ์ -> ์๋ฌธ์ id = id.toLowerCase(); // 2๋จ๊ณ. ์ํ๋ฒณ, ์ซ์, -, _, . ์ ์ธ ๋ชจ๋ ์ ๊ฑฐ let re = /[^a-z0-9-_.]/g; id = id.replace(re, ''); // 3๋จ๊ณ. ๋ง์นจํ 2๋ฒ ์ด์ ์ฐ์์ ํ๋๋ก ์นํ re = /[.][.]+/g; id = id.replace(re, '.'); // 4๋จ๊ณ. ๋ง์นจํ ์ฒ์ ํน์ ๋์ ์์นํ๋ค๋ฉด ์ ๊ฑฐ id = [...id]; if (id[0] === '.') { id.shift(); } if (id[id.length - 1] === '.') { id.pop(); } id = id.join..
[JS] 2020์นด์นด์ค - ํคํจ๋ ๋๋ฅด๊ธฐ
function solution(numbers, hand) { let leftPosition = [0, 3]; let rightPosition = [2, 3]; let leftColumn = [1, 4, 7]; let centerColumn = [2, 5, 8, 0]; let rightColumn = [3, 6, 9]; let total = [leftColumn, centerColumn, rightColumn]; let result = ''; for (let num of numbers) { if (leftColumn.includes(num)) { result += 'L'; leftPosition = [0, leftColumn.indexOf(num)]; } else if (rightColumn.includ..