mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2026-02-02 18:39:09 +08:00
更新代码块
This commit is contained in:
@@ -56,7 +56,7 @@ dp[i][0]:word2为空字符串,以i-1为结尾的字符串word2要删除多
|
||||
|
||||
dp[0][j]的话同理,所以代码如下:
|
||||
|
||||
```C++
|
||||
```CPP
|
||||
vector<vector<int>> dp(word1.size() + 1, vector<int>(word2.size() + 1));
|
||||
for (int i = 0; i <= word1.size(); i++) dp[i][0] = i;
|
||||
for (int j = 0; j <= word2.size(); j++) dp[0][j] = j;
|
||||
@@ -78,7 +78,7 @@ for (int j = 0; j <= word2.size(); j++) dp[0][j] = j;
|
||||
|
||||
以上分析完毕,代码如下:
|
||||
|
||||
```C++
|
||||
```CPP
|
||||
class Solution {
|
||||
public:
|
||||
int minDistance(string word1, string word2) {
|
||||
|
||||
Reference in New Issue
Block a user