스택/큐 - 프린터
·
Algorithm/프로그래머스
https://programmers.co.kr/learn/courses/30/lessons/42587 코딩테스트 연습 - 프린터 일반적인 프린터는 인쇄 요청이 들어온 순서대로 인쇄합니다. 그렇기 때문에 중요한 문서가 나중에 인쇄될 수 있습니다. 이런 문제를 보완하기 위해 중요도가 높은 문서를 먼저 인쇄하는 프린 programmers.co.kr public class Printer { public int solution(int[] priorities, int location) { int answer = 0; // 1. 우선 순위 큐 (큰 수가 우선순위 가짐) PriorityQueue queue = new PriorityQueue(Collections.reverseOrder()); // 2. 우선순위 큐에 ..