https://leetcode.com/problems/top-k-frequent-elements/ 2. 2022.04.08 시도 소요시간: 7분 class Solution { public int[] topKFrequent(int[] nums, int k) { Map countMap = new HashMap(); for (int i=0; i { return o1.getValue().compareTo(o2.getValue()) * -1; }); int counter=0; int[] ret = new int[k]; for (Map.Entry each: list) { ret[counter++] = each.getKey(); if (counter == k) { break; } } return ret; } } 풀이..