Add rust code for backtracking problems#79
Add rust code for backtracking problems#79nikhilmitrax wants to merge 3 commits intoByteByteGoHq:mainfrom
Conversation
Destiny-02
left a comment
There was a problem hiding this comment.
Hi @nikhilmitrax, thank you for writing the Rust solutions for the Backtracking chapter! Looks good overall, just a few comments for you to check.
| @@ -0,0 +1,41 @@ | |||
| pub fn combinations_of_sum_k(nums: Vec<i32>, target: i32) -> Vec<Vec<i32>> { | |||
There was a problem hiding this comment.
The existing rust solutions in the Sliding Windows chapter don't use pub fn. If there is a reason to use pub fn instead of fn, please update the solutions in Sliding Windows. Otherwise, we can stick to fn.
There was a problem hiding this comment.
I believe pub fn makes more sense since the functions aren't really useful without having public visibility and being isolated in a file.
As is, the rust functions aren't particularly usable without a module setup and at least a project definition (Cargo.toml)
I see 3 potential paths moving forward, and I'm perfectly fine with all 3 options, do you have a preference?
Options:
- Remove pub everywhere
- Add pub to all functions that should be usable outside a file.
- Add pub to all functions that should be usable outside a file, and add a Cargo.toml (possibly along with lib.rs and some tests, so that
cargo testruns through the examples)
There was a problem hiding this comment.
Option 1 please!
Here is some background if you're interested: #54 (comment)
There was a problem hiding this comment.
I don't see the change, have you pushed?
f3f21b2 to
8464870
Compare
|
Closing this pull request due to inactivity. Feel free to reopen or submit a new one. |
Mainly porting the python algorithms, and trying to follow similar paradigm as the python code.
Mostly written by hand, albeit with AI autocomplete on.