We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 602a30c + 17718c9 commit 65ee2f6Copy full SHA for 65ee2f6
1 file changed
lkhyun/202510/14 PGM Lv2 짝지어 제거하기.md
@@ -0,0 +1,21 @@
1
+```java
2
+import java.util.*;
3
+class Solution
4
+{
5
+ public int solution(String s)
6
+ {
7
+ int answer = -1;
8
+ Stack<Character> stk = new Stack<>();
9
+
10
+ for(char c : s.toCharArray()){
11
+ if(stk.isEmpty() || stk.peek() != c){
12
+ stk.push(c);
13
+ }else{
14
+ stk.pop();
15
+ }
16
17
18
+ return stk.isEmpty() ? 1 : 0;
19
20
+}
21
+```
0 commit comments