Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Thanks for your effort :)
This version in C++ was recently approved and I checked authorĀ“s translation is inactive. I'll ask for an user that manages well with this language. Sorry for that.
Hi!
Problem with C++.
Test is OK, but when attempting it throws:
In file included from main.cpp:7:
./tests.cpp:22:40: error: use of undeclared identifier 'h'
for (; lowest < 10; lowest++) r += h(n - lowest, digits - 1, lowest);
1 error generated.
Thanks for your very quick reply, you're absolutely right. Works now :-)
This error is caused by your code, your code doesn't respect the original signature which is
fn find_all(sum_dig: u8, digs: u8) -> Option<(usize, u64, u64)>
. The testing function in attempt tests contains explicit types, so it cannot pass.Hi! I'm facing a problem in the Rust version.
Initial tests pass 100% OK, but when submitting for full test suite, the following appears:
Thank you
Time: 1060ms Errors: 1Exit Code: 101
STDERR:
error[E0308]: mismatched types
--> src/lib.rs:81:59
|
81 | assert_eq!(find_all(n, k), reference_solution(n, k), "\nWith sum_dig = {}, digs = {}", n, k);
| ^ expected
u8
, foundi32
|
help: you can convert an
i32
to au8
and panic if the converted value doesn't fit|
81 | assert_eq!(find_all(n, k), reference_solution(n.try_into().unwrap(), k), "\nWith sum_dig = {}, digs = {}", n, k);
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/lib.rs:81:62
|
81 | assert_eq!(find_all(n, k), reference_solution(n, k), "\nWith sum_dig = {}, digs = {}", n, k);
| ^ expected
u8
, foundi32
|
help: you can convert an
i32
to au8
and panic if the converted value doesn't fit|
81 | assert_eq!(find_all(n, k), reference_solution(n, k.try_into().unwrap()), "\nWith sum_dig = {}, digs = {}", n, k);
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/lib.rs:87:59
|
87 | assert_eq!(find_all(n, k), reference_solution(n, k), "\nWith sum_dig = {}, digs = {}", n, k);
| ^ expected
u8
, foundi32
|
help: you can convert an
i32
to au8
and panic if the converted value doesn't fit|
87 | assert_eq!(find_all(n, k), reference_solution(n.try_into().unwrap(), k), "\nWith sum_dig = {}, digs = {}", n, k);
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/lib.rs:87:62
|
87 | assert_eq!(find_all(n, k), reference_solution(n, k), "\nWith sum_dig = {}, digs = {}", n, k);
| ^ expected
u8
, foundi32
|
help: you can convert an
i32
to au8
and panic if the converted value doesn't fit|
87 | assert_eq!(find_all(n, k), reference_solution(n, k.try_into().unwrap()), "\nWith sum_dig = {}, digs = {}", n, k);
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/lib.rs:93:59
|
93 | assert_eq!(find_all(n, k), reference_solution(n, k), "\nWith sum_dig = {}, digs = {}", n, k);
| ^ expected
u8
, foundi32
|
help: you can convert an
i32
to au8
and panic if the converted value doesn't fit|
93 | assert_eq!(find_all(n, k), reference_solution(n.try_into().unwrap(), k), "\nWith sum_dig = {}, digs = {}", n, k);
| ++++++++++++++++++++
error[E0308]: mismatched types
--> src/lib.rs:93:62
|
93 | assert_eq!(find_all(n, k), reference_solution(n, k), "\nWith sum_dig = {}, digs = {}", n, k);
| ^ expected
u8
, foundi32
|
help: you can convert an
i32
to au8
and panic if the converted value doesn't fit|
93 | assert_eq!(find_all(n, k), reference_solution(n, k.try_into().unwrap()), "\nWith sum_dig = {}, digs = {}", n, k);
| ++++++++++++++++++++
For more information about this error, try
rustc --explain E0308
.error: could not compile
challenge
due to 6 previous errorsNOTE: Line numbers in error messages can be incorrect due to concatenation.