https://school.programmers.co.kr/learn/courses/30/lessons/12909
스택/큐
def solution(s):
stack = []
for i in s:
if not stack:
stack.append(i)
else:
if stack[-1] == '(' and i == ')':
stack.pop()
else:
stack.append(i)
if stack:
return False
return True
바로 앞에서 한 짝지어 제거하기랑 매우 유사해서 금방 풀었다!