fix: check the rust codes and fix them (#653)

* fix: check the rust codes and fix it

* Update binary_tree_bfs.rs

---------

Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
Night Cruising
2023-07-24 22:27:26 +08:00
committed by GitHub
parent 978d3c2ed7
commit fdbe275fc9
18 changed files with 167 additions and 102 deletions

View File

@ -33,7 +33,7 @@ fn subset_sum_i(nums: &mut [i32], target: i32) -> Vec<Vec<i32>> {
let state = Vec::new(); // 状态(子集)
nums.sort(); // 对 nums 进行排序
let start = 0; // 遍历起始点
let mut res = Vec::new();
let mut res = Vec::new(); // 结果列表(子集列表)
backtrack(state, target, nums, start, &mut res);
res
}

View File

@ -29,8 +29,8 @@ fn backtrack(mut state: Vec<i32>, target: i32, total: i32, choices: &[i32], res:
/* 求解子集和 I包含重复子集 */
fn subset_sum_i_naive(nums: &[i32], target: i32) -> Vec<Vec<i32>> {
let state = Vec::new(); // 状态(子集)
let total = 0;
let mut res = Vec::new();
let total = 0; // 子集和
let mut res = Vec::new(); // 结果列表(子集列表)
backtrack(state, target, total, nums, &mut res);
res
}

View File

@ -38,7 +38,7 @@ fn subset_sum_ii(nums: &mut [i32], target: i32) -> Vec<Vec<i32>> {
let state = Vec::new(); // 状态(子集)
nums.sort(); // 对 nums 进行排序
let start = 0; // 遍历起始点
let mut res = Vec::new();
let mut res = Vec::new(); // 结果列表(子集列表)
backtrack(state, target, nums, start, &mut res);
res
}