https://school.programmers.co.kr/learn/courses/30/lessons/42748 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 전체 코드 def solution(array, commands): answer = [] for i, j, k in commands: tmp_array = array[i-1:j] tmp_array.sort() answer.append(tmp_array[k-1]) return answer
Coding Test
https://school.programmers.co.kr/learn/courses/30/lessons/42628 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 아이디어 heap의 heappop과 list의 pop을 사용해서 풀었다. elif operation == "D 1": # 최댓값 삭제 queue.sort() queue.pop() 최댓값을 삭제할 때는 리스트 정렬 후 pop 해주고, elif operation == "D -1": # 최솟값 삭제 heapify(queue) heappop(queue) 최솟값을 삭제할 때는 heapify로 리스트를 힙 ..
https://school.programmers.co.kr/learn/courses/30/lessons/42627 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 아이디어 최소힙을 사용하여 푸는 문제였다. for time, job in jobs: if start < time 0: job_tmp, time_tmp = heapq.heappop(heap) start = now now += job_tmp answer += (now - time_tmp) i += 1 continue now += 1 만약 heap에 값이 있다면, heap에 있는 값을 꺼낸다. star..
https://leetcode.com/problems/word-pattern/description/?envType=study-plan-v2&envId=top-interview-150 Word Pattern - LeetCode Can you solve this real interview question? Word Pattern - Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Example leetcode.com 전체 코드 ..