Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- dp
- pcce 기출문제 풀이
- making anagrams
- c++
- special string again
- boj 1717
- string construction
- boj 1074
- the maximum subarray
- PCCE
- the longest increasing subsequence
- lock based queue
- DirectX
- find the town judge
- 브루트포스
- count triplets
- 프로그래밍공부
- find the running median
- boj 5719
- gas
- two characters
- pccp 기출문제 풀이
- LCS
- lock free stack
- 지게차와 크레인
- 2025 프로그래머스 코딩챌린지 1차예선
- DirectX12
- lock based stack
- boj 11657
- ice cream parlor
Archives
- Today
- Total
목록python 올바른 괄호 (1)
오구의코딩모험

[코딩테스트 고득점 KIT - 스택/큐] 완벽하게 닫혀있는 "()"를 제외시켜준다. 제외 후, 문자열이 비어있다면 올바른 괄호! "(" 괄호가 끝에 있거나, ")" 괄호로 시작하는 경우는 올바르지 않은 괄호! 또는 "(" 괄호와 ")" 괄호의 갯수가 같지 않으면, 올바르지 않은 괄호이다! 이 경우를 제외하곤 올바른 괄호! def solution(s): s = s.replace("()","") if len(s) == 0: return True if (s[0] == ")") or (s[-1] == "(") or (s.count("(") != s.count(")")): return False return True
프로그래밍 공부/프로그래머스
2022. 12. 24. 22:59