본문 바로가기

Coding Test190

[Programmers] (완전탐색) Lv 2. 모음사전 https://school.programmers.co.kr/learn/courses/30/lessons/84512 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(word) { const res = {}; let idx = 0; const alphabet = ['A', 'E', 'I', 'O', 'U']; (dfs = (now, cnt) => { if (cnt > 5) return; res[now] = idx++; if (now === word) return; for (let i = 0; i < 5; ++i) { next =.. 2023. 2. 23.
[Programmers] (2022 KAKAO BLIND RECRUITMENT) Lv 2. 주차 요금 계산 https://school.programmers.co.kr/learn/courses/30/lessons/92341 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(fees, records) { records = records.reduce( (acc, el) => { const record = el.split(" "); acc[record[2]].push(record[0] + " " + record[1]); return acc; }, { IN: [], OUT: [] } ); parking = records.IN.reduce((.. 2023. 2. 22.
[Programmers] (2018 KAKAO BLIND RECRUITMENT) Lv 2. [3차] n진수 게임 https://school.programmers.co.kr/learn/courses/30/lessons/17687 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(n, t, m, p) { const max = m * (t - 1) + p; const answer = []; let numbers = ""; let value = 0; while (numbers.length < max) numbers += (value++).toString(n); let i = 0; while (answer.length < t) { if ((i %.. 2023. 2. 22.
[Programmers] Lv 2. 할인 행사 https://school.programmers.co.kr/learn/courses/30/lessons/131127 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr const solution = (want, number, discount) => { return discount.reduce( (acc, el) => { if (acc.queue.length >= 10) var shifted = acc.queue.shift(); acc.queue.push(el); if (want.some((e) => e === shifted)) ++number[want.inde.. 2023. 2. 20.
[Programmers] Lv 2. 땅따먹기 https://school.programmers.co.kr/learn/courses/30/lessons/12913 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(land) { return Math.max(...land.reduce((acc, arr, idx) => { if (acc.length e === max); const nextMax = Math.max(...acc.filter((_, idx) => idx !== maxIdx)); return arr.map((e, i) => (i !== maxIdx) ? e + max.. 2023. 2. 18.
[Programmers] (2018 KAKAO BLIND RECRUITMENT) Lv 2. [3차] 압축 https://school.programmers.co.kr/learn/courses/30/lessons/17684 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(msg) { const alphabet = "abcdefghijklmnopqrstuvwxyz".toUpperCase(); const container = [...alphabet].reduce((accumulator, value, index) => { return { ...accumulator, [value]: ++index }; }, {}); const answer.. 2023. 2. 17.
[Programmers] (2022 KAKAO BLIND RECRUITMENT) Lv 2. k진수에서 소수 개수 구하기 https://school.programmers.co.kr/learn/courses/30/lessons/92335 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(n, k) { const isPrime = (N) => { if (["1", ""].includes(N)) return false; for (let i = 2; i isPrime(e)).length; } GitHub : https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/main/%ED%94%84%.. 2023. 2. 16.
[Programmers] (2018 KAKAO BLIND RECRUITMENT) Lv 2. [1차] 뉴스 클러스터링 https://school.programmers.co.kr/learn/courses/30/lessons/17677 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(str1, str2) { // 숫자, 공백 제거 // 특수문자, 괄호, 공백 모두 제거 - 점은 제거 안함 const reg1 = /[0-9 ]/gim, reg2 = /[`.,~!@#$%^&*()_|+\-=?;:'"\{\}\[\]\\\/ ]/gim; const str = [str1, str2]; for (const i in str) { str[i] = [...str.. 2023. 2. 16.
[Programmers] (깊이/너비 우선 탐색[DFS/BFS]) Lv 2. 타겟 넘버 https://school.programmers.co.kr/learn/courses/30/lessons/43165 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(numbers, target) { var answer = 0; const dfs = (idx, sum) => { if (idx >= numbers.length) { if (target === sum) answer++; return; } dfs(idx + 1, sum + numbers[idx]); dfs(idx + 1, sum - numbers[idx]); }; df.. 2023. 2. 15.
[Programmers] (스택/큐) Lv 2. 프린터 https://school.programmers.co.kr/learn/courses/30/lessons/42587 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(priorities, location) { const recursive = (res, data) => { if (!data.some((e, i) => data[0] < e && 0 < i)) { if (0 == location) return res.length + 1; res.push(data[0]); --location; } else { location = (lo.. 2023. 2. 14.