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.
Seems like that's the bug for Ruby testing; raised an issue about that
This comment is hidden because it contains spoiler information about the solution
See the issue above. When you mutated the input, you changed the expected value, so even if your result was ok, the tests compared it against a different value.
If it only fails random tests, then one possible reason is your code mutating the input array, check that.
Added ;-)
You're using
.digits
which is actually very slow for this. There is a much faster way ;-)You shouldn't write a function, you should only write the regular expression. Sites like regex101.com could help.