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