Study/코딩테스트 연습
올바른 괄호
soyeonland
2024. 6. 21. 21:00
.
def solution(s):
stack = []
for i in range(len(s)):
item = s[i]
if item == '(':
stack.append(item)
else:
if len(stack)>=1:
stack.pop()
else:
return False
if len(stack)==0:
return True
else:
return False
#print(s)