Skip to content

Commit 8b960f9

Browse files
Merge pull request youngyangyang04#1680 from chenzhg-maker/dev
Update 0072.编辑距离 C语言版本
2 parents 838a4fc + 6ab8d50 commit 8b960f9

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

problems/0072.编辑距离.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ function minDistance(word1: string, word2: string): number {
364364

365365
C:
366366

367+
367368
```c
368369
int min(int num1, int num2, int num3) {
369370
return num1 > num2 ? (num2 > num3 ? num3 : num2) : (num1 > num3 ? num3 : num1);
@@ -376,7 +377,7 @@ int minDistance(char * word1, char * word2){
376377
for (int i = 1; i <= strlen(word2); i++) dp[0][i] = i;
377378

378379
for (int i = 1; i <= strlen(word1); i++) {
379-
for (int j = 1; j <=strlen(word2); j++) {
380+
for (int j = 1; j <= strlen(word2); j++) {
380381
if (word1[i-1] == word2[j-1]) {
381382
dp[i][j] = dp[i-1][j-1];
382383
}
@@ -389,7 +390,5 @@ int minDistance(char * word1, char * word2){
389390
}
390391
```
391392
392-
393-
394393
-----------------------
395394
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>

0 commit comments

Comments
 (0)