본문 바로가기

코딩테스트187

[Programmers] (2017 팁스타운) Lv 2. 짝지어 제거하기 https://school.programmers.co.kr/learn/courses/30/lessons/12973?language=javascript 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(s) { const stack = []; for(let i = 0 ; i < s.length ; i++ ) (!stack.length || stack[stack.length - 1] !== s[i]) ? stack.push(s[i]) : stack.pop(); return stack.length ? 0 : 1; } GitHub :.. 2023. 1. 26.
[LeetCode] (Design) Lv Easy. Shuffle an Array https://leetcode.com/explore/interview/card/top-interview-questions-easy/98/design/670/ 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 */ var Solution = function(nums) { this.original = [.... 2023. 1. 25.
[Programmers] Lv 2. 다음 큰 숫자 https://school.programmers.co.kr/learn/courses/30/lessons/12911 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(n) { const len = n.toString(2).split("1").length - 1; ++n; while (len != n.toString(2).split("1").length - 1) ++n; return n; } GitHub : https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/ma.. 2023. 1. 25.
[Programmers] (Dynamic Programming) Lv 2. 피보나치 수 https://school.programmers.co.kr/learn/courses/30/lessons/12945 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(n) { let dp = [0, 1, 1]; for (let i = 3; i 2023. 1. 25.
[Programmers] Lv 2. 숫자의 표현 https://school.programmers.co.kr/learn/courses/30/lessons/12924 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(n) { let answer = 0; for (let i = 1; i 2023. 1. 25.
[Programmers] (월간 코드 챌린지 시즌1) Lv 2. 이진 변환 반복하기 https://school.programmers.co.kr/learn/courses/30/lessons/70129 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(s) { let convert = 0, erase = 0; while (s !== "1") { erase += s.split("0").length - 1; s = s.replace(/0/g, ""); ++convert; s = s.length.toString(2); } return [convert, erase]; } GitHub : https://github.com.. 2023. 1. 24.
[Programmers] (스택/큐) Lv 2. 올바른 괄호 https://school.programmers.co.kr/learn/courses/30/lessons/12909 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(s) { let res = 0; for (let e of s) { e === "(" ? ++res : --res; if (res < 0) return false; } return !res; } GitHub : https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/main/%ED%94%84%EB%A1%.. 2023. 1. 24.
[LeetCode] (Math) Lv Easy. Fizz Buzz https://leetcode.com/explore/interview/card/top-interview-questions-easy/102/math/743/ 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} n * @return {string[]} */ function fizzBuzz(n) { let answer = .. 2023. 1. 22.
[LeetCode] (Dynamic Programming) Lv Easy. Climbing Stairs https://leetcode.com/explore/interview/card/top-interview-questions-easy/97/dynamic-programming/569/ 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} n * @return {number} */ var climbStairs = functi.. 2023. 1. 22.
[LeetCode] (Sorting and Searching) Lv Easy. First Bad Version https://leetcode.com/explore/interview/card/top-interview-questions-easy/96/sorting-and-searching/774/ 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 /** * Definition for isBadVersion() * * @param {integer} version num.. 2023. 1. 22.