From 2260a3f8660fec639e6046be6f0482abfe5b8a95 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Fri, 17 Oct 2025 16:39:21 +0900 Subject: [PATCH] =?UTF-8?q?[20251017]=20PGM=20/=20Lv2=20/=20=EC=98=81?= =?UTF-8?q?=EC=96=B4=20=EB=81=9D=EB=A7=90=EC=9E=87=EA=B8=B0=20/=20?= =?UTF-8?q?=EC=9D=B4=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...35\353\247\220\354\236\207\352\270\260.md" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "lkhyun/202510/17 PGM Lv2 \354\230\201\354\226\264 \353\201\235\353\247\220\354\236\207\352\270\260.md" diff --git "a/lkhyun/202510/17 PGM Lv2 \354\230\201\354\226\264 \353\201\235\353\247\220\354\236\207\352\270\260.md" "b/lkhyun/202510/17 PGM Lv2 \354\230\201\354\226\264 \353\201\235\353\247\220\354\236\207\352\270\260.md" new file mode 100644 index 00000000..0cec4d9a --- /dev/null +++ "b/lkhyun/202510/17 PGM Lv2 \354\230\201\354\226\264 \353\201\235\353\247\220\354\236\207\352\270\260.md" @@ -0,0 +1,28 @@ +```java +import java.util.*; +class Solution { + public int[] solution(int n, String[] words) { + + Map history = new HashMap<>(); + + int fail = 0; + String prev = words[0]; + history.put(prev,true); + for(int i=1;i1){ + prev = words[i]; + history.put(words[i],true); + }else{ + fail = i; + break; + } + } + if(fail == 0){ + return new int[]{0,0}; + } + return new int[]{(fail%n)+1,(fail/n)+1}; + } +} +```