From a6255d8c2c27e81eb90c4932bd5f89122f5d234c Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Wed, 22 Oct 2025 23:58:06 +0900 Subject: [PATCH] =?UTF-8?q?[20251022]=20PGM=20/=20LV2=20/=20=EC=A7=9D?= =?UTF-8?q?=EC=A7=80=EC=96=B4=20=EC=A0=9C=EA=B1=B0=20/=20=EC=9D=B4?= =?UTF-8?q?=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement solution to remove adjacent pairs from a string. --- ...200\354\226\264 \354\240\234\352\261\260.md" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "LiiNi-coder/202510/22 PGM \354\247\235\354\247\200\354\226\264 \354\240\234\352\261\260.md" diff --git "a/LiiNi-coder/202510/22 PGM \354\247\235\354\247\200\354\226\264 \354\240\234\352\261\260.md" "b/LiiNi-coder/202510/22 PGM \354\247\235\354\247\200\354\226\264 \354\240\234\352\261\260.md" new file mode 100644 index 00000000..99b85e18 --- /dev/null +++ "b/LiiNi-coder/202510/22 PGM \354\247\235\354\247\200\354\226\264 \354\240\234\352\261\260.md" @@ -0,0 +1,17 @@ +```java +import java.util.*; + +class Solution { + public int solution(String s){ + Stack stack = new Stack<>(); + for(char c : s.toCharArray()){ + if(!stack.isEmpty() && stack.peek() == c){ + stack.pop(); + }else{ + stack.push(c); + } + } + return stack.isEmpty() ? 1 : 0; + } +} +```