Skip to content

Commit

Permalink
이슈 #404에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 2, 2024
1 parent 5a62fe9 commit 2970119
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Programmers/올바른_괄호.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include<string>
#include <iostream>
#include <stack>

using namespace std;

bool solution(string s) {
stack<char> st;

for (char c : s) {
if (c == '(') {
st.push(c);
} else {
if (st.empty()) {
return false;
}
st.pop();
}

}

return st.empty();
}

0 comments on commit 2970119

Please sign in to comment.