diff --git "a/LiiNi-coder/202510/27 PGM \352\267\244 \352\263\240\353\245\264\352\270\260.md" "b/LiiNi-coder/202510/27 PGM \352\267\244 \352\263\240\353\245\264\352\270\260.md" new file mode 100644 index 00000000..6b692d71 --- /dev/null +++ "b/LiiNi-coder/202510/27 PGM \352\267\244 \352\263\240\353\245\264\352\270\260.md" @@ -0,0 +1,24 @@ +```java +import java.util.*; + +class Solution { + public int solution(int k, int[] tangerine) { + int answer = 0; + Map countsAtSize = new TreeMap<>(); + for(int t: tangerine){ + countsAtSize.put(t, countsAtSize.getOrDefault(t, 0) + 1); + } + List ss = new ArrayList<>(countsAtSize.values()); + Collections.sort(ss, Collections.reverseOrder()); + + for(int s: ss){ + k -= s; + answer++; + if(k<=0){ + break; + } + } + return answer; + } +} +```