From 17718c9988ab770b6cf47d48f74fa574ecd3ddad Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Tue, 14 Oct 2025 22:14:38 +0900 Subject: [PATCH] =?UTF-8?q?[20251014]=20PGM=20/=20Lv2=20/=20=EC=A7=9D?= =?UTF-8?q?=EC=A7=80=EC=96=B4=20=EC=A0=9C=EA=B1=B0=ED=95=98=EA=B8=B0=20/?= =?UTF-8?q?=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 --- ...34\352\261\260\355\225\230\352\270\260.md" | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "lkhyun/202510/14 PGM Lv2 \354\247\235\354\247\200\354\226\264 \354\240\234\352\261\260\355\225\230\352\270\260.md" diff --git "a/lkhyun/202510/14 PGM Lv2 \354\247\235\354\247\200\354\226\264 \354\240\234\352\261\260\355\225\230\352\270\260.md" "b/lkhyun/202510/14 PGM Lv2 \354\247\235\354\247\200\354\226\264 \354\240\234\352\261\260\355\225\230\352\270\260.md" new file mode 100644 index 00000000..d204f8e5 --- /dev/null +++ "b/lkhyun/202510/14 PGM Lv2 \354\247\235\354\247\200\354\226\264 \354\240\234\352\261\260\355\225\230\352\270\260.md" @@ -0,0 +1,21 @@ +```java +import java.util.*; +class Solution +{ + public int solution(String s) + { + int answer = -1; + Stack stk = new Stack<>(); + + for(char c : s.toCharArray()){ + if(stk.isEmpty() || stk.peek() != c){ + stk.push(c); + }else{ + stk.pop(); + } + } + + return stk.isEmpty() ? 1 : 0; + } +} +```