일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 컴퓨터의 구조
- t1
- Regular Expression
- Python Implementation
- shiba
- 파이썬
- 109. Convert Sorted List to Binary Search Tree
- Generator
- 43. Multiply Strings
- Decorator
- kaggle
- Python Code
- 30. Substring with Concatenation of All Words
- 밴픽
- Class
- Protocol
- attribute
- 315. Count of Smaller Numbers After Self
- iterator
- Python
- 시바견
- 운영체제
- 프로그래머스
- concurrency
- LeetCode
- data science
- DWG
- Convert Sorted List to Binary Search Tree
- 715. Range Module
- Substring with Concatenation of All Words
Archives
- Today
- Total
목록edit distance (1)
Scribbling
LeetCode: 72. Edit Distance
class Solution: def minDistance(self, word1: str, word2: str) -> int: m, n = len(word1), len(word2) dp = [[0] * (m+1) for _ in range(n+1)] for i in range(1, m+1): dp[0][i] = i for i in range(1, n+1): dp[i][0] = i for i in range(1, n+1): for j in range(1, m+1): if word1[j-1] != word2[i-1]: dp[i][j] = min(dp[i-1][j-1], dp[i-1][j], dp[i][j-1]) + 1 else: dp[i][j] = min(dp[i-1][j-1], dp[i-1][j]+1, dp..
Computer Science/Coding Test
2021. 9. 26. 19:44