Coding Test/Python

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 전체 코드 ..
https://leetcode.com/problems/ransom-note/?envType=study-plan-v2&envId=top-interview-150 Ransom Note - LeetCode Can you solve this real interview question? Ransom Note - Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise. Each letter in magazine can only be used once in ranso leetcode.com 전체 코드 from colle..
https://school.programmers.co.kr/learn/courses/30/lessons/42626 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 전체 코드 import heapq def solution(scoville, K): heapq.heapify(scoville) count = 0 while True: curr = heapq.heappop(scoville) if curr < K: try: count += 1 heapq.heappush(scoville, curr + (heapq.heappop(scoville) * 2)) except: ..
lim.dev
'Coding Test/Python' 카테고리의 글 목록 (12 Page)