본문 바로가기

Coding Test190

[Programmers] (스택/큐) Lv 2. 기능개발 https://school.programmers.co.kr/learn/courses/30/lessons/42586 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr const solution = (progresses, speeds) => { return progresses.map((el, idx) => Math.ceil((100 - el) / speeds[idx])).reduce((queue, el) => { (queue.length = el) ? queue[q.. 2023. 2. 13.
[Programmers] (월간 코드 챌린지 시즌3) Lv 2. n^2 배열 자르기 https://school.programmers.co.kr/learn/courses/30/lessons/87390 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(n, left, right) { return Array.from({ length: right - left + 1 }, (undefined, idx) => { idx += left; return Math.max(parseInt(idx / n) + 1, idx % n + 1); }); } GitHub : https://github.com/developeSHG/Algor.. 2023. 2. 10.
[Programmers] (2019 카카오 개발자 겨울 인턴십) Lv 2. 튜플 https://school.programmers.co.kr/learn/courses/30/lessons/64065 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(s) { s = s.replace(/{/g, "").replace(/},/g, " ").replace(/}/g, "").split(" ").sort((a, b) => a.length - b.length); return s.reduce((acc, el) => { el = el.split(","); if (acc.length < el.length) { acc.forEa.. 2023. 2. 9.
[Programmers] (해시) Lv 2. 의상 https://school.programmers.co.kr/learn/courses/30/lessons/42578 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(clothes) { var answer = 1; const map = new Map(); clothes.forEach((pair) => map.set(pair[1], map.get(pair[1]) ? map.get(pair[1]) + 1 : 1)); for (const [key, value] of map.entries()) answer *= (value + 1); .. 2023. 2. 7.
[Programmers] Lv 2. 행렬의 곱셈 https://school.programmers.co.kr/learn/courses/30/lessons/12949 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(arr1, arr2) { return arr1.map((row) => { return arr2[0].map((_, col) => { return row.reduce((acc, e, idx) => acc + e * arr2[idx][col], 0); }); }); } GitHub : https://github.com/developeSHG/Algorithm-Baekjo.. 2023. 2. 7.
[LeetCode] (Strings) Lv Easy. First Unique Character in a String https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/881/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com /** * @param {string} s * @return {number} */ var firstUniqChar = function (s) { .. 2023. 2. 6.
[LeetCode] (Array) Lv Easy. Contains Duplicate https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/578/ Explore - LeetCode LeetCode Explore is the best place for everyone to start practicing and learning on LeetCode. No matter if you are a beginner or a master, there are always new topics waiting for you to explore. leetcode.com /** * @param {number[]} nums * @return {boolean} */ var containsDuplicate = function.. 2023. 2. 6.
[Programmers] (월간 코드 챌린지 시즌2) Lv 2. 괄호 회전하기 https://school.programmers.co.kr/learn/courses/30/lessons/76502 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr const solution = (s) => { const obj = { "[": "]", "(": ")", "{": "}", }; return [...s].reduce((acc, el, idx) => { const stack = []; for (let i = 0; i < s.length; ++i) { const a = (idx + i) % s.length; if (Object.keys(obj).f.. 2023. 2. 6.
[Programmers] (2018 KAKAO BLIND RECRUITMENT) Lv 2. [1차] 캐시 https://school.programmers.co.kr/learn/courses/30/lessons/17680 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(cacheSize, cities) { const queue = []; let runTime = 0; cities.forEach(data => { data = data.toLowerCase(); if (queue.includes(data)) { queue.splice(queue.findIndex((e) => e === data), 1); runTime++; } els.. 2023. 2. 4.
[Programmers] (정렬) Lv 2. H-Index https://school.programmers.co.kr/learn/courses/30/lessons/42747 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr const solution = (citations) => citations.sort((a, b) => b - a).filter((e, idx) => e > idx).length; GitHub : https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/main/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8.. 2023. 2. 4.