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.
I may be wrong, but I don't think nested loops will work here.
This comment is hidden because it contains spoiler information about the solution
Hi Guys,
Thank you both for spending your time on providing a more clear explanation.
@awesomead - the code was indeed buggy. I'm currently learning to code in RUST and things are much more different than with other languages (in a positive way, I'd say).
P.S. - Once I submitted a working variant of my code and saw the solutions of other people - I realized how much more there is to learn. The positive thing here is that I already received some feedback about the fact that very often "clever" solutions are much more difficult to debug in the future... I gues that depending on the point of view - there might actually be some positives to writing without too much of syntactic sugar.
Enjoy the rest of the day / week.
Cheers,
Rust translation improved, ready for approval.
The tests are fine. Hobovsky explained the confusion you seem to be having above.
It seems that your code is simply buggy, in that is trying to unwrap the
Result
fromparse()
, which is invalid if the Result is an Error. This is why usingunwrap
is typically bad habit. Check your numbers before parsing them.Not exactly. The kata wants you to perform the so-called "silly addition" every time. It;s just some inputs sometimes result in behavior identical to "normal addition". For example, when you do the "silly addition" with inputs
12 + 44
, you will still get 56.See if this paragraph is of any help: https://docs.codewars.com/training/troubleshooting#print-input, and maybe raise a suggestion to make assertion messages clearer.
Hi Guys,
Can someone please help me?
I've written the code that solves the kata in RUST (I tested it manually with different number combos), but when I "Attempt" the kata officially >>> I get the following result(s):
=============================================================
tests::test_big
assertion failed:
(left == right)
left:
3021499
,right:
31499
tests::test_random
called
Result::unwrap()
on anErr
value: ParseIntError { kind: PosOverflow } at src/lib.rs:53:43tests::test_real
assertion failed:
(left == right)
left:
3
,right:
13
tests::test_silly
Test Passed
I checked the tests which the creator has made, and it seems that he / she / they are testing 2 different functions:
Here is what I mean:
#[test]
fn test_real_add() {
assert_eq!(add(2, 11), 13);
assert_eq!(add(0, 1), 1);
assert_eq!(add(0, 0), 0);
}
#[test]
fn test_silly_add() {
assert_eq!(add(16, 18), 214);
assert_eq!(add(26, 39), 515);
assert_eq!(add(122, 81), 1103);
}
This comment is hidden because it contains spoiler information about the solution
Hi,
I have the same question as Alexander.
The wording used in the "Deatils" states >> "a boolean true if ALL rotations of strng are included in arr (C returns 1)"
How comes a string which contains only 4 of the possible rotations gives us a result of: true? :(
Regards,
This comment is hidden because it contains spoiler information about the solution
What's the first number in the array you build?
What's the value of d in the tests you're failing? You can use
console.log
to print the input values.This comment is hidden because it contains spoiler information about the solution
Your code is failing one of the sample tests too, check that, and how you build you array, that'll help.
This comment is hidden because it contains spoiler information about the solution