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
- find the running median
- boj 1074
- DirectX12
- c++
- PCCE
- lock free stack
- count triplets
- boj 11657
- 2025 프로그래머스 코딩챌린지 1차예선
- ice cream parlor
- boj 6443
- pccp 기출문제 풀이
- 프로그래밍공부
- lock based queue
- the maximum subarray
- find the town judge
- LCS
- boj 1717
- two characters
- lock based stack
- gas
- 지게차와 크레인
- string construction
- the longest increasing subsequence
- special string again
- DirectX
- 브루트포스
- pcce 기출문제 풀이
- making anagrams
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