Skip to content

Commit

Permalink
Update subset_sum_ii.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
krahets authored Aug 26, 2024
1 parent a40b69a commit 7666361
Showing 1 changed file with 1 addition and 1 deletion.
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 @@ -32,7 +32,7 @@ fn backtrack(
}
// 尝试:做出选择,更新 target, start
state.push(choices[i]);
// 进行下一轮选择,从i+1开始,避免重复选择
// 进行下一轮选择
backtrack(state, target - choices[i], choices, i + 1, res);
// 回退:撤销选择,恢复到之前的状态
state.pop();
Expand Down

0 comments on commit 7666361

Please sign in to comment.