문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/12909
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
def solution(s):
stack = []
answer = False
for i in s:
if i == '(':
stack.append(i)
else:
if not stack:
stack.append(i)
break
else:
stack.pop()
if not stack:
answer = True
return answer
s = '))))'
print(solution(s))
'CodingTest > Programmers' 카테고리의 다른 글
| [프로그래머스 Lv2] 피보나치 수(python, DP) (0) | 2025.04.10 |
|---|---|
| [프로그래머스 Lv2] 숫자의 표현(python, 완전탐색) (0) | 2025.04.10 |
| [프로그래머스 Lv2] 이진 변환 반복하기(python, 구현) (0) | 2025.04.10 |
| [프로그래머스 Lv2] JadenCase 문자열 만들기(python, 구현) (0) | 2025.04.10 |
| [프로그래머스 Lv2] 최솟값 만들기(python, 그리디, 정렬) (0) | 2025.04.10 |