This is a Rust implementation that calculates subset sum problem. It returns sets of integers that sum up to a target value.
Binary files are provided on the Releases page. When you download one of these, please add it to your PATH manually.
First, you need to prepare a text file containing a set of integers like this
1
2
-3
4
5
and save it at any place.
Second, call subset_sum
with the path of the text file and the target sum.
Call subset_sum.exe num_set.txt 3
The executable's name subset_sum.exe
would be different from your choice. Change this example along with your environment.
In this example, the output is
[[1, 2], [2, -3, 4], [1, -3, 5]]
Cargo.toml
[dependencies]
subset_sum = "0.4.2"
main.rs
```rust
use subsetsum::dp::findsubset;
fn main() { let result = find_subset(&vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10); println!("{:?}", result); } ```