[ 알고리즘 ]/Heap

    [프로그래머스] 더 맵게

    📌문제 https://programmers.co.kr/learn/courses/30/lessons/42626 🎖️난이도 Level 2 ✔️풀이 # sol) heapq 이용 import heapq def solution(scoville, K): cnt = 0 heapq.heapify(scoville) ''' s_list = [] for s in scoville: heapq.heappush(s_list, s) ''' while 1: if len(scoville) == 1 and scoville[0] = K: return cnt else: cnt += 1 heapq.heappush(scoville, heapq.heappop(scoville) + heap..