Skip to content

Commit

Permalink
更新 编辑距离系列 排版格式修复
Browse files Browse the repository at this point in the history
  • Loading branch information
jinbudaily committed Jul 26, 2023
1 parent 9b0c0f2 commit a0edc60
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 29 deletions.
19 changes: 11 additions & 8 deletions problems/0072.编辑距离.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ exection -> execution (插入 'u')
* 0 <= word1.length, word2.length <= 500
* word1 和 word2 由小写英文字母组成

# 算法公开课
**《代码随想录》算法视频公开课:[动态规划终极绝杀! LeetCode:72.编辑距离](https://www.bilibili.com/video/BV1we4y157wB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**
## 算法公开课
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html)[动态规划终极绝杀! LeetCode:72.编辑距离](https://www.bilibili.com/video/BV1we4y157wB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**

## 思路

Expand Down Expand Up @@ -227,8 +227,8 @@ public:
## 其他语言版本
### Java:
Java:
```java
public int minDistance(String word1, String word2) {
int m = word1.length();
Expand Down Expand Up @@ -256,7 +256,8 @@ public int minDistance(String word1, String word2) {
}
```

Python:
### Python:

```python
class Solution:
def minDistance(self, word1: str, word2: str) -> int:
Expand All @@ -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)
Expand Down Expand Up @@ -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));
Expand All @@ -338,7 +340,7 @@ const minDistance = (word1, word2) => {
};
```

TypeScript:
### TypeScript:

```typescript
function minDistance(word1: string, word2: string): number {
Expand Down Expand Up @@ -373,7 +375,7 @@ function minDistance(word1: string, word2: string): number {
};
```

C:
### C:


```c
Expand Down Expand Up @@ -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>
18 changes: 10 additions & 8 deletions problems/0115.不同的子序列.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ public:
## 其他语言版本
### Java:
Java:
```java
class Solution {
public int numDistinct(String s, String t) {
Expand All @@ -182,7 +182,8 @@ class Solution {
}
```

Python:
### Python:

```python
class Solution:
def numDistinct(self, s: str, t: str) -> int:
Expand All @@ -200,7 +201,8 @@ class Solution:
return dp[-1][-1]
```

Python3:
### Python3:

```python
class SolutionDP2:
"""
Expand Down Expand Up @@ -234,7 +236,8 @@ class SolutionDP2:
return dp[-1]
```

Go:
### Go:

```go
func numDistinct(s string, t string) int {
dp:= make([][]int,len(s)+1)
Expand All @@ -259,8 +262,8 @@ func numDistinct(s string, t string) int {
}
```

### Javascript:

Javascript:
```javascript
const numDistinct = (s, t) => {
let dp = Array.from(Array(s.length + 1), () => Array(t.length +1).fill(0));
Expand All @@ -283,7 +286,7 @@ const numDistinct = (s, t) => {
};
```

TypeScript:
### TypeScript:

```typescript
function numDistinct(s: string, t: string): number {
Expand Down Expand Up @@ -312,9 +315,8 @@ function numDistinct(s: string, t: string): number {
```




<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>

16 changes: 9 additions & 7 deletions problems/0583.两个字符串的删除操作.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* 解释: 第一步将"sea"变为"ea",第二步将"eat"变为"ea"


# 算法公开课
## 算法公开课

**《代码随想录》算法视频公开课[动态规划之子序列,还是为了编辑距离做铺垫 | LeetCode:583.两个字符串的删除操(https://www.bilibili.com/video/BV1we4y157wB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**。
**[《代码随想录》算法视频公开课](https://programmercarl.com/other/gongkaike.html)[LeetCode:583.两个字符串的删除操](https://www.bilibili.com/video/BV1we4y157wB/),相信结合视频再看本篇题解,更有助于大家对本题的理解**


## 思路
Expand Down Expand Up @@ -143,8 +143,8 @@ public:
## 其他语言版本
### Java:
Java:
```java
// dp数组中存储word1和word2最长相同子序列的长度
class Solution {
Expand Down Expand Up @@ -215,8 +215,8 @@ class Solution {
}
```

### Python:

Python:
```python
class Solution:
def minDistance(self, word1: str, word2: str) -> int:
Expand All @@ -234,7 +234,8 @@ class Solution:
return dp[-1][-1]
```

Go:
### Go:

```go
func minDistance(word1 string, word2 string) int {
dp := make([][]int, len(word1)+1)
Expand Down Expand Up @@ -267,7 +268,8 @@ func min(a, b int) int {
return b
}
```
Javascript:
### Javascript:

```javascript
// 方法一
var minDistance = (word1, word2) => {
Expand Down Expand Up @@ -309,7 +311,7 @@ var minDistance = function (word1, word2) {
};
```

TypeScript:
### TypeScript:

> dp版本一:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ else {

## 其他语言版本

### Java:

Java:
```java
class Solution {
public int minDistance(String word1, String word2) {
Expand Down Expand Up @@ -193,15 +193,11 @@ class Solution {
}
```

Python:


Go:




<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>

0 comments on commit a0edc60

Please sign in to comment.