프로그래머스 프린터
-
Level2) 프린터PS/programmers 2020. 10. 9. 18:20
import java.util.LinkedList; import java.util.Queue; class Solution { public int solution(int[] priorities, int location) { int answer = 0; Queue q = new LinkedList(); for (int i = 0; i < priorities.length; i++) { q.offer(new Printer(i, priorities[i])); } while (!q.isEmpty()) { boolean flag = false; int com = q.peek().prior; // 맨 앞 for (Printer p : q) { if (com < p.prior) { flag = true; } } if (..