class Solution {
    public int[] solution(int k, int[] score) {
        int[] answer = new int[score.length];

        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>();

        int temp = 0;

        for(int i = 0; i < score.length; i++) {

            priorityQueue.add(score[i]);
            if (priorityQueue.size() > k) {
                priorityQueue.poll();
            }

            answer[i] = priorityQueue.peek();
        }

        return answer;
    }

< 목차 >


7/31 (날라갈거 같아서 저장용)

8/4 프로그래머스 lv.1 가장 가까운 같은 글자

풀이 과정

정답 코드

걸린 시간

Trouble Shooting

다른 사람의 코드

lastIndexOf(), indexOf()


8/16 프로그래머스 lv.1 폰켓몬

폰켓몬 잡으러 가기!

풀이 로직

나의 답변

시간 복잡도