https://school.programmers.co.kr/learn/courses/30/lessons/12909
스택 활용할 줄 아냐? 의 기본 문제급이다
#include <string>
#include <iostream>
#include <stack>
using namespace std;
stack<int> st;
bool solution(string s)
{
int len = s.size();
for(int i = 0 ; i < len; i++)
{
if(!st.empty() && s[i] == ')' && st.top() == '(')
st.pop();
else st.push(s[i]);
}
return st.empty();
}
1트 성공!