본문 바로가기

전체 글540

[Programmers] Lv 2. 귤 고르기 https://school.programmers.co.kr/learn/courses/30/lessons/138476 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(k, tangerine) { const temp = {}; tangerine.forEach((element) => { temp[element] = ++temp[element] || 1; }); const arr = Object.values(temp).sort((a, b) => b - a); let sum = 0, answer = 0; for (let num of .. 2023. 1. 16.
[LeetCode] (Linked List) Lv Easy. Delete Node in a Linked List https://leetcode.com/explore/interview/card/top-interview-questions-easy/93/linked-list/553/ 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 singly-linked list. * function ListNode(val) { * this.val.. 2023. 1. 16.
[Programmers] Lv 1. 과일 장수 https://school.programmers.co.kr/learn/courses/30/lessons/135808 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(k, m, score) { var answer = 0; score = score .sort((a, b) => b - a) .filter( (e, index) => 1 2023. 1. 16.
[LeetCode] (Strings) Lv Easy. Reverse Integer https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/880/ 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} x * @return {number} */ function t1(x) { let result = parse.. 2023. 1. 16.
[LeetCode] (Array) Lv Easy. Best Time to Buy and Sell Stock II https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/564/ 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[]} prices * @return {number} */ var maxProfit = function (price.. 2023. 1. 16.
[Programmers] Lv 1. 기사단원의 무기 https://school.programmers.co.kr/learn/courses/30/lessons/136798 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(number, limit, power) { let a = 0; for (let cur = 1; cur 2023. 1. 15.
[Programmers] Lv 1. 명예의 전당(1) https://school.programmers.co.kr/learn/courses/30/lessons/138477 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(k, score) { var award = []; return score.reduce((a, element) => { if (k > award.length) { award.push(element); award.sort((a, b) => a - b); } else if (element >= award.at(0)) { award.push(element); award... 2023. 1. 15.
[LeetCode] (Array) Lv Easy. Remove Duplicates from Sorted Array https://leetcode.com/explore/interview/card/top-interview-questions-easy/92/array/727/ 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 {number} */ var removeDuplicates = function(n.. 2023. 1. 14.
[Programmers] Lv 1. 문자열 나누기 https://school.programmers.co.kr/learn/courses/30/lessons/140108 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr function solution(s) { var first; var countArr = new Array(3).fill(0); [...s].forEach((element, index) => { first ||= element; if (element === first) ++countArr[0]; else ++countArr[1]; if (countArr[0] === countArr[1]) { ++.. 2023. 1. 14.
[LeetCode] (Array) Lv Easy. Find Target Indices After Sorting Array https://leetcode.com/problems/find-target-indices-after-sorting-array/description/ Find Target Indices After Sorting Array - LeetCode Find Target Indices After Sorting Array - You are given a 0-indexed integer array nums and a target element target. A target index is an index i such that nums[i] == target. Return a list of the target indices of nums after sorting nums in non-decreasing o leetcod.. 2023. 1. 12.