From 9521bafbda8bd264341e0708672e3bc09fc183ac Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Tue, 4 Nov 2025 23:43:43 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[20251101]=20PGM=20/=20Lv2=20/=20[3?= =?UTF-8?q?=EC=B0=A8]=20=EC=95=95=EC=B6=95=20/=20=EC=9D=B4=EA=B0=95?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\260\250] \354\225\225\354\266\225.md" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "lkhyun/202511/04 PGM Lv2 [3\354\260\250] \354\225\225\354\266\225.md" diff --git "a/lkhyun/202511/04 PGM Lv2 [3\354\260\250] \354\225\225\354\266\225.md" "b/lkhyun/202511/04 PGM Lv2 [3\354\260\250] \354\225\225\354\266\225.md" new file mode 100644 index 00000000..3778d8eb --- /dev/null +++ "b/lkhyun/202511/04 PGM Lv2 [3\354\260\250] \354\225\225\354\266\225.md" @@ -0,0 +1,34 @@ +```java +import java.util.*; + +class Solution { + public int[] solution(String msg) { + List answer = new ArrayList<>(); + Map dictionary = new HashMap<>(); + for(int i = 1; i <= 26; i++){ + dictionary.put(String.valueOf((char)(64 + i)), i); + } + int dictionaryIdx = 27; + + int cur = 0; + while(cur < msg.length()){ + String w = String.valueOf(msg.charAt(cur)); + + while(cur + w.length() < msg.length() && + dictionary.containsKey(w + msg.charAt(cur + w.length()))){ + w = w + msg.charAt(cur + w.length()); + } + answer.add(dictionary.get(w)); + + if(cur + w.length() < msg.length()){ + String wc = w + msg.charAt(cur + w.length()); + dictionary.put(wc, dictionaryIdx++); + } + + cur += w.length(); + } + + return answer.stream().mapToInt(Integer::intValue).toArray(); + } +} +``` From 500c1708788cf068d5690be31a529a64190e8795 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Tue, 4 Nov 2025 23:44:44 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[20251104]=20PGM=20/=20Lv2=20/=20[3?= =?UTF-8?q?=EC=B0=A8]=20=EC=95=95=EC=B6=95=20/=20=EC=9D=B4=EA=B0=95?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit