Fix a definition.

This commit is contained in:
krahets
2023-08-27 00:50:18 +08:00
parent debf42b189
commit 9731a46d67
85 changed files with 167 additions and 159 deletions

View File

@@ -73,7 +73,7 @@ fn edit_distance_dp(s: &str, t: &str) -> i32 {
dp[n][m]
}
/* 编辑距离:状态压缩后的动态规划 */
/* 编辑距离:空间优化后的动态规划 */
fn edit_distance_dp_comp(s: &str, t: &str) -> i32 {
let (n, m) = (s.len(), t.len());
let mut dp = vec![0; m + 1];
@@ -124,7 +124,7 @@ pub fn main() {
let res = edit_distance_dp(s, t);
println!("{s} 更改为 {t} 最少需要编辑 {res}");
// 状态压缩后的动态规划
// 空间优化后的动态规划
let res = edit_distance_dp_comp(s, t);
println!("{s} 更改为 {t} 最少需要编辑 {res}");
}