From 10f1d0031002bbd9bac2b1d24842937e87b54286 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Sat, 13 Dec 2025 19:18:16 +0900 Subject: [PATCH] =?UTF-8?q?[20251213]=20PGM=20/=20=ED=8A=9C=ED=94=8C=20/?= =?UTF-8?q?=20LV2=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 --- .../13 PGM \355\212\234\355\224\214.md" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "LiiNi-coder/202512/13 PGM \355\212\234\355\224\214.md" diff --git "a/LiiNi-coder/202512/13 PGM \355\212\234\355\224\214.md" "b/LiiNi-coder/202512/13 PGM \355\212\234\355\224\214.md" new file mode 100644 index 00000000..0f00cc25 --- /dev/null +++ "b/LiiNi-coder/202512/13 PGM \355\212\234\355\224\214.md" @@ -0,0 +1,25 @@ +import java.util.*; + +class Solution { + public int[] solution(String s) { + s = s.substring(2, s.length() - 2); + String[] groups = s.split("}", "{"); + + Arrays.sort(groups, (a, b) -> a.length() - b.length()); + Set used = new HashSet(); + int[] answer = new int[groups.length]; + int index = 0; + for(String group : groups){ + String[] nums = group.split(","); + for(String num : nums){ + int value = Integer.parseInt(num); + if(!used.contains(value)){ + used.add(value); + answer[index++] = value; + break; + } + } + } + return answer; + } +}