We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7a70926 commit 7a5c7c5Copy full SHA for 7a5c7c5
1 file changed
ksinji/202601/22 PGM 짝지어 제거하기.md
@@ -0,0 +1,21 @@
1
+```java
2
+import java.util.*;
3
+
4
+class Solution {
5
+ public int solution(String s) {
6
+ char[] arr = s.toCharArray();
7
+ char[] stack = new char[arr.length];
8
+ int top = 0;
9
10
+ for (char c : arr) {
11
+ if (top > 0 && stack[top - 1] == c) {
12
+ top--;
13
+ } else {
14
+ stack[top++] = c;
15
+ }
16
17
18
+ return top == 0 ? 1 : 0;
19
20
+}
21
+```
0 commit comments