Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backtracking): minor mistake in Rust code for subset_sum_ii #1487

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codes/rust/chapter_backtracking/subset_sum_ii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn backtrack(
// 尝试:做出选择,更新 target, start
state.push(choices[i]);
// 进行下一轮选择
backtrack(state, target - choices[i], choices, i, res);
backtrack(state, target - choices[i], choices, i + 1, res);
// 回退:撤销选择,恢复到之前的状态
state.pop();
}
Expand Down
2 changes: 1 addition & 1 deletion zh-hant/codes/rust/chapter_backtracking/subset_sum_ii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn backtrack(
// 嘗試:做出選擇,更新 target, start
state.push(choices[i]);
// 進行下一輪選擇
backtrack(state.clone(), target - choices[i], choices, i, res);
backtrack(state.clone(), target - choices[i], choices, i + 1, res);
// 回退:撤銷選擇,恢復到之前的狀態
state.pop();
}
Expand Down