Compiling solution v0.1.0 (/tmp/d20221011-1221210-ormdmn/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.59s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-gv62el/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.55s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1liu01o/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-6bhgnd/solution)
warning: function `main` is never used
--> src/lib.rs:15:4
|
15 | fn main() {
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `solution` (lib) generated 1 warning
Finished test [unoptimized + debuginfo] target(s) in 0.52s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1rby7u7/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.58s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1wnbmvj/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.52s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1bon5ep/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.58s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-uaby12/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.51s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1n6vfe6/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.52s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-wyl5vq/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1qlxxzj/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1dlns4f/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.52s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1x1u5t6/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-15fmu0e/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.58s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-gng964/solution)
warning: function `main` is never used
--> src/lib.rs:1:4
|
1 | fn main() {
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `solution` (lib) generated 1 warning
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-xlz8vo/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-13ntl7t/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-3jntrx/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-gg7nr4/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.51s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1kc30r/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.49s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1j9cmme/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.51s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-107i2bk/solution)
warning: function `main` is never used
--> src/lib.rs:10:4
|
10 | fn main() {
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `solution` (lib) generated 1 warning
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-bxnh1n/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.51s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
// reused my own solution of the same problem from the past edition of the course
pubfnfib(n:u32)->u32{
ifn==0{return0}
ifn==1{return1}
else{returnfib(n-1)+fib(n-2)}
}
Compiling solution v0.1.0 (/tmp/d20221011-1221210-w56r2m/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1rrf9e5/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1upj5nc/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.51s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
//I found also a solve with "match" as I was looking through some materials
//Even though it's the same logic I think it represents the possibilities in the rust language better
//fn fib(n: u32) -> u32 {
// match n {
// 0 => 1,
// 1 => 1,
// _ => fib(n - 1) + fib(n - 2),
// }
//}
Compiling solution v0.1.0 (/tmp/d20221011-1221210-mjzj1j/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-11tn7af/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-17kzjo2/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.52s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
// Doesn't seem like good practice to pass arrays like dis
fnoptfib(a:u32,slice:&mut[u32;100])->u32{
ifslice[aasusize]!=0{returnslice[aasusize];};// Not sure if I can go around [a as usize] as it is kinda annoying to type everytime
ifa==0{return0asu32;};
ifa==1{return1asu32;};
slice[aasusize]=(optfib(a-1,slice)+optfib(a-2,slice))asu32;//If I can get feedback why I can't use this as a return statement like in C++ I'll be very glad
optfib(a-1,slice)+optfib(a-2,slice)// Cause if i could this line would be useless
}
pubfnfib(n:u32)->u32{
letmutarray:[u32;100]=[0;100];
optfib(n,&mutarray)
}
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1ol7alx/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-in7wt5/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.52s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-j36s8m/solution)
warning: function `main` is never used
--> src/lib.rs:10:4
|
10 | fn main() {
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `solution` (lib) generated 1 warning
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-4vzow5/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-d5uf3x/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-1xqrkx3/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
println!("Nth Fibonacci number is: {}",fib(param))
}
else{
println!("At least one argument is needed.");
}
}
Compiling solution v0.1.0 (/tmp/d20221011-1221210-u6cxcl/solution)
warning: function `main` is never used
--> src/lib.rs:21:4
|
21 | fn main() {
| ^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `solution` (lib) generated 1 warning
Finished test [unoptimized + debuginfo] target(s) in 0.61s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-13xhqk/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-bdyltg/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.50s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Compiling solution v0.1.0 (/tmp/d20221011-1221210-quk1yy/solution)
Finished test [unoptimized + debuginfo] target(s) in 0.55s
Running tests/solution_test.rs (target/debug/deps/solution_test-867d7317a91c4f07)
running 1 test
test solution_test::test_full ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s