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