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
Thank you for the fun exercise!
Rust translation of the kata doesn't handle floating point comparisons well. Usually, with the tests that include floating numbers, it is common to specify the precision with which they should be compared. However, I cannot see what this kata has to do with floating numbers. They don't add any value in comparison to integers, only technical problems.
My code had problems in dealing with numbers that are more than 4 digits long. There are no such numbers in example tests. I used 20000 and 1, with expected output (3, 10000, 21001): 1000, 10000, 10001.
After refreshing the page, the problem with negative inputs seems to be solved. Thanks!
Nope. It still tests my function on negative numbers:
thread 'random_tests' panicked at 'n = -7458'
.The output says:
My program has this line:
Talking about Rust. What should the program do with negative inputs? Instructions say it should operate only on non-negative, but random tests suggest that the reference implementation does something non-trivial to them: it's neither panic, nor negated
thirt(n.abs())
value.