We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5936c43 commit 5af56b4Copy full SHA for 5af56b4
2 files changed
프로그래머스/2/12973. 짝지어 제거하기/README.md
@@ -4,7 +4,7 @@
4
5
### 성능 요약
6
7
-메모리: 14.8 MB, 시간: 144.24 ms
+메모리: 65.3 MB, 시간: 87.64 ms
8
9
### 구분
10
@@ -16,7 +16,7 @@
16
17
### 제출 일자
18
19
-2024년 2월 1일 21:36:5
+2025년 06월 02일 21:17:49
20
21
### 문제 설명
22
프로그래머스/2/12973. 짝지어 제거하기/짝지어 제거하기.java
@@ -0,0 +1,22 @@
1
+import java.util.*;
2
+
3
+class Solution
+{
+ static Stack<Character> stack = new Stack<>();
+ public int solution(String s)
+ {
+ for(char c : s.toCharArray()){
11
+ if(stack.isEmpty()){ //스택 비어있으면 그냥 push
12
+ stack.push(c);
13
+ }else if(stack.peek().equals(c)){ //스택 맨 위의 값이 현재값과 같으면 pop
14
+ stack.pop();
15
+ }else{
+ stack.push(c); //스택 맨 위의 값이 현재값과 다르면 push
+ }
+ return stack.isEmpty() ? 1 : 0;
+}
0 commit comments