We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 37f78ca commit 42023a3Copy full SHA for 42023a3
프로그래머스/2/12909. 올바른 괄호/README.md
@@ -4,7 +4,7 @@
4
5
### 성능 요약
6
7
-메모리: 10.4 MB, 시간: 7.22 ms
+메모리: 54.4 MB, 시간: 18.33 ms
8
9
### 구분
10
@@ -16,7 +16,7 @@
16
17
### 제출 일자
18
19
-2024년 2월 1일 21:35:25
+2025년 05월 28일 18:22:52
20
21
### 문제 설명
22
프로그래머스/2/12909. 올바른 괄호/올바른 괄호.java
@@ -0,0 +1,25 @@
1
+import java.util.*;
2
+
3
+class Solution {
+ static Stack<Character> stack = new Stack<>();
+ boolean solution(String s) {
+ boolean answer = true;
+ for(int i=0; i<s.length(); i++){
+ char ch = s.charAt(i);
11
12
+ // '('면 스택에 추가, ')'면 스택이 비어있는지 확인 후 pop
13
+ if(ch == '('){
14
+ stack.push('(');
15
+ }else{
+ if(stack.isEmpty()){
+ return false;
+ }
+ stack.pop();
23
+ return (stack.isEmpty())? true:false;
24
25
+}
0 commit comments