일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- sql
- 시간복잡도
- import re
- 연습문제
- mysql
- 조합
- python
- coding test
- 데이터분석
- 코딩테스트
- BFS
- Stack
- 코딩
- 완전탐색
- cte
- lv4
- level4
- Level2
- Queue
- counter
- 코테
- coding
- join
- programmers
- time complexity
- itertools
- 파이썬
- collections
- 프로그래머스
- lambda
- Today
- Total
목록12973 (1)
ror_coding
[Programmers] 올바른 괄호 - 12909, 짝지어 제거하기 - 12973
stack.pop() 사용하기 ! index 조절 때문에 고민 좀 했다..올바른 괄호, 짝지어 제거하기 둘 다 같은 문제라 같이 기록한다. Question : 올바른 괄호 - 12909 '(' 또는 ')' 로만 이루어진 문자열 s가 주어졌을 때, 문자열 s가 올바른 괄호이면 true를 return 하고, 올바르지 않은 괄호이면 false를 return 하는 solution 함수를 완성해 주세요. Code def solution(s): stack = [] for i in s: if not stack : stack.append(i); continue if stack[-1] =='(' and i==')' : stack.pop() else : stack.appen..
Algorithm/Python
2024. 10. 28. 13:52