更新 编辑距离系列 排版格式修复

This commit is contained in:
jinbudaily
2023-07-26 16:21:21 +08:00
parent 9b0c0f20dc
commit a0edc60d1f
4 changed files with 32 additions and 29 deletions

View File

@@ -40,8 +40,8 @@ exection -> execution (插入 'u')
* 0 <= word1.length, word2.length <= 500
* word1 和 word2 由小写英文字母组成
# 算法公开课
**《代码随想录》算法视频公开课:[动态规划终极绝杀! LeetCode72.编辑距离](https://www.bilibili.com/video/BV1we4y157wB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
## 算法公开课
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html)[动态规划终极绝杀! LeetCode72.编辑距离](https://www.bilibili.com/video/BV1we4y157wB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
## 思路
@@ -227,8 +227,8 @@ public:
## 其他语言版本
### Java
Java
```java
public int minDistance(String word1, String word2) {
int m = word1.length();
@@ -256,7 +256,8 @@ public int minDistance(String word1, String word2) {
}
```
Python
### Python
```python
class Solution:
def minDistance(self, word1: str, word2: str) -> int:
@@ -274,7 +275,8 @@ class Solution:
return dp[-1][-1]
```
Go
### Go
```Go
func minDistance(word1 string, word2 string) int {
m, n := len(word1), len(word2)
@@ -310,8 +312,8 @@ func Min(args ...int) int {
}
```
### Javascript
Javascript
```javascript
const minDistance = (word1, word2) => {
let dp = Array.from(Array(word1.length + 1), () => Array(word2.length+1).fill(0));
@@ -338,7 +340,7 @@ const minDistance = (word1, word2) => {
};
```
TypeScript
### TypeScript
```typescript
function minDistance(word1: string, word2: string): number {
@@ -373,7 +375,7 @@ function minDistance(word1: string, word2: string): number {
};
```
C
### C
```c
@@ -405,3 +407,4 @@ int minDistance(char * word1, char * word2){
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>