From ad663615e64476af70fb230308ce8cee5c48f88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=93=E6=98=A5=E9=A3=8E?= <77157236+night-cruise@users.noreply.github.com> Date: Sat, 6 Jan 2024 14:47:32 +0800 Subject: [PATCH] Fix the issues of discusscomment 7949412 and 7985550 (#1027) --- codes/rust/chapter_dynamic_programming/coin_change_ii.rs | 4 ++-- docs/chapter_data_structure/basic_data_types.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/codes/rust/chapter_dynamic_programming/coin_change_ii.rs b/codes/rust/chapter_dynamic_programming/coin_change_ii.rs index 3da73510a..8306e530d 100644 --- a/codes/rust/chapter_dynamic_programming/coin_change_ii.rs +++ b/codes/rust/chapter_dynamic_programming/coin_change_ii.rs @@ -20,7 +20,7 @@ fn coin_change_ii_dp(coins: &[i32], amt: usize) -> i32 { // 若超过目标金额,则不选硬币 i dp[i][a] = dp[i - 1][a]; } else { - // 不选和选硬币 i 这两种方案的较小值 + // 不选和选硬币 i 这两种方案之和 dp[i][a] = dp[i - 1][a] + dp[i][a - coins[i - 1] as usize]; } } @@ -41,7 +41,7 @@ fn coin_change_ii_dp_comp(coins: &[i32], amt: usize) -> i32 { // 若超过目标金额,则不选硬币 i dp[a] = dp[a]; } else { - // 不选和选硬币 i 这两种方案的较小值 + // 不选和选硬币 i 这两种方案之和 dp[a] = dp[a] + dp[a - coins[i - 1] as usize]; } } diff --git a/docs/chapter_data_structure/basic_data_types.md b/docs/chapter_data_structure/basic_data_types.md index 31c8d46e3..d1a020ccc 100644 --- a/docs/chapter_data_structure/basic_data_types.md +++ b/docs/chapter_data_structure/basic_data_types.md @@ -138,7 +138,7 @@ ```rust title="" // 使用多种基本数据类型来初始化数组 let numbers: Vec = vec![0; 5]; - let decimals: Vec = vec![0.0, 5]; + let decimals: Vec = vec![0.0; 5]; let characters: Vec = vec!['0'; 5]; let bools: Vec = vec![false; 5]; ```