[문제링크 - 프로그래머스 - 더 맵게] https://born2bedeveloper.tistory.com/11
import java.util.PriorityQueue;
class Solution {
public int solution(int[] scoville, int K) {
int answer = 0;
PriorityQueue<Integer> pq = new PriorityQueue<>();
for(int s : scoville){
pq.offer(s);
}
while(pq.peek() < K){
if(pq.size() == 1){
return -1;
}
int a = pq.poll();
int b = pq.poll();
pq.offer(a + b * 2);
answer++;
}
return answer;
}
}