
🔑우선순위 큐를 이용
int result = 0;
int[] scoville = {1, 2, 3, 9, 10, 12};
int k = 7;
//우선순위 큐 선언
PriorityQueue<Integer> pq = new PriorityQueue<>();
//큐에 스코빌수치 값들 삽입
for (int i : scoville) pq.add(i);
//가장 작은 값이 K 이상이라면 return 0
if(pq.peek()>=K) return result;
//큐의 가장 작은 값이 K미만일 경우
while(pq.peek() < K){
//큐의 사이즈가 1이라면, return -1
if(pq.size() == 1) return -1;
//가장 작은 두개의 값 제거 및 반환하여 계산 후 다시 삽입
int a = pq.poll();
int b = pq.poll();
pq.add(a+(b*2));
result +=1 ;
}

if (result == 0) return -1;
return result;
}