From 291f95652bbd6b713eb451dab635f2abdb4c1e34 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Tue, 16 Dec 2025 23:41:52 +0900 Subject: [PATCH] =?UTF-8?q?[20251216]=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=EA=B0=95=ED=98=84?= 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" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "lkhyun/202512/16 PGM Lv2 \352\267\244 \352\263\240\353\245\264\352\270\260.md" diff --git "a/lkhyun/202512/16 PGM Lv2 \352\267\244 \352\263\240\353\245\264\352\270\260.md" "b/lkhyun/202512/16 PGM Lv2 \352\267\244 \352\263\240\353\245\264\352\270\260.md" new file mode 100644 index 00000000..12bfa82f --- /dev/null +++ "b/lkhyun/202512/16 PGM Lv2 \352\267\244 \352\263\240\353\245\264\352\270\260.md" @@ -0,0 +1,23 @@ +```java +import java.util.*; +class Solution { + static Map count = new HashMap<>(); + public int solution(int k, int[] tangerine) { + int answer = 0; + for(int t : tangerine){ + count.put(t,count.getOrDefault(t,0) + 1); + } + List countList = new ArrayList<>(count.values()); + countList.sort(Comparator.reverseOrder()); + int sum = 0; + for(int cur : countList){ + sum+=cur; + answer++; + if(sum >= k){ + return answer; + } + } + return answer; + } +} +```