프로그래머스 이중우선순위큐 - java


프로그래머스 이중우선순위큐 - java

우선순위큐 두 개를 사용해본다. import java.util.*; class Solution { public int[] solution(String[] operations) { int[] answer = new int[2]; PriorityQueue<Integer> pq_max = new PriorityQueue<>(Collections.reverseOrder()); PriorityQueue<Integer> pq_min = new PriorityQueue<>(); for (String operation : operations){ String[] operationSplit = operation.split(" "); if (operationSplit[0].equals("I")){ pq_max.add(Integer.parseInt(operationSplit[1])); pq_min.add(Integer.parseInt(operationSplit[1])); } else { // operat...



원문링크 : 프로그래머스 이중우선순위큐 - java