From 0bab862de197dba371a3d35c878c5dd0f3a88832 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Mon, 27 Oct 2025 23:46:48 +0900 Subject: [PATCH] =?UTF-8?q?[20251027]=20PGM=20/=20LV2=20/=20=EA=B7=A4=20?= =?UTF-8?q?=EA=B3=A0=EB=A5=B4=EA=B8=B0=20/=20=EC=9D=B4=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \352\263\240\353\245\264\352\270\260.md" | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 "LiiNi-coder/202510/27 PGM \352\267\244 \352\263\240\353\245\264\352\270\260.md" 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; + } +} +```