일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- t1
- DWG
- shiba
- Python
- data science
- Generator
- Convert Sorted List to Binary Search Tree
- Decorator
- LeetCode
- kaggle
- Class
- Regular Expression
- Protocol
- 컴퓨터의 구조
- 시바견
- 운영체제
- iterator
- concurrency
- 715. Range Module
- Python Code
- 109. Convert Sorted List to Binary Search Tree
- 프로그래머스
- 밴픽
- Substring with Concatenation of All Words
- Python Implementation
- 43. Multiply Strings
- 파이썬
- 315. Count of Smaller Numbers After Self
- 30. Substring with Concatenation of All Words
- attribute
Archives
- Today
- Total
목록10. Regular Expression Matching (1)
Scribbling
LeetCode: 10. Regular Expression Matching
여러 경우의 수를 다 고려해봐야 한다. 어려운 문제이긴하나, dp를 써야한다는 점과 dp table의 크기를 정하는 것이 핵심. 여기서 matched[i][j]: p[i-1]까지의 패턴 문자열이 s[j-1] 문자열을 cover함을 의미. class Solution(object): def isMatch(self, s, p): matched = [[False] * (len(s)+1) for _ in range(len(p)+1)] matched[0][0] = True for i in range(2, len(p)+1): if p[i-1] == '*': matched[i][0] = matched[i-2][0] for i in range(1, len(p)+1): for j in range(1, len(s)+1): ..
Computer Science/Coding Test
2021. 9. 14. 20:29