Untitled

시도 1. Queue 이용, Stream.fliter()를 이용한 원소의 크기 비교 → 통과

import java.util.LinkedList;
import java.util.Queue;
class Solution {
            public int solution(int[] priorities, int location) {
                int answer = 0;
                Queue<Integer> queue = new LinkedList<>();
                for (int priority : priorities) {
                    queue.add(priority);
                }
                System.out.println(queue);
                while (!queue.isEmpty()) {
                    int poll = queue.poll();
                    if (queue.stream().filter(integer -> integer > poll).count() == 0) {
                        answer++;
                        if (location == 0) {
                            break;
                        } else {
                            location--;
                        }
                    } else {
                        if (location == 0) {
                            location = queue.size();
                        } else {
                            location--;
                        }
                        queue.add(poll);
                    }
                }
                return answer;
            }
        }