일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Protocol
- Python Implementation
- LeetCode
- Python
- 시바견
- attribute
- Convert Sorted List to Binary Search Tree
- iterator
- 109. Convert Sorted List to Binary Search Tree
- Class
- 715. Range Module
- 운영체제
- Regular Expression
- t1
- concurrency
- Substring with Concatenation of All Words
- 파이썬
- 30. Substring with Concatenation of All Words
- Generator
- 315. Count of Smaller Numbers After Self
- Decorator
- shiba
- Python Code
- kaggle
- 43. Multiply Strings
- 컴퓨터의 구조
- data science
- 프로그래머스
- DWG
- 밴픽
Archives
- Today
- Total
목록72. 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