문제


풀이
import heapq
def solution(scoville, K):
heapq.heapify(scoville)
cnt = 0
while len(scoville)>=2:
cnt += 1
top1 = heapq.heappop(scoville)
top2 = heapq.heappop(scoville)
target = top1+top2*2
heapq.heappush(scoville, target)
if scoville[0] >= K:
return cnt
return -1