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.
yes: least significant bit is set for every odd number ;-)
"& 1"? :o
2 months and no reaction=> rejected.
This comment is hidden because it contains spoiler information about the solution
One random test is not sufficient. The norm is 100 random tests (though it can vary; Rust is very fast, and in a kata like this one, you can securely increase the number of tests, I don't say it is necessary). You need to make length random too. Look at tests in other languages. Also, I think it would be more convenient to use a vector of characters rather than strings (vectors element can be accessed instantaneously by index, while you need to generate an iterator to extract a character from a string, this is probably much more inefficient and however not handy). You also need to include non alphabetic characters, like in fixed tests. When you translate a kata, you must try to make tests coherent with other languages, and in particular its original language if you can (unless there are issues raised about them). Original languages is JavaScript, please refer to the tests and try to stick with them: https://www.codewars.com/kumite/625fd4bc473605001611222e?sel=6261718f22d52c00165e5f68
Random test on https://www.codewars.com/kumite/6265f7afe67fbaf7b37204a6?sel=6265f7afe67fbaf7b37204a6
Thanks for your comment.
No random tests.
I've adapted @My-'s code to Rust 1.60 and rand::Rng +0.8.0 (Changelog 'gen_range(a, b) was replaced with gen_range(a..b)" ir order to compile the battery of tests.
I suggest to include (Rust language) this test in order to check non empty vector when all elements are zero (see my last exercise attempt to understand the reason):
Clever too much since test asserts don't cover when all elements in array are 0 ;-)
I suggest to include this new assert in the exercise: