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.
Wow! Thanks! Didn't understand how to approach this one so solved the one you recommended first and now the solution for this one is clear to me :)
It is not clearly specified how we should treat spaces. In some random tests, we got multiple adjacent spaces. To me it seems we should ignore any empty words we might get when splitting the text into words.
Hi catchaser, yes, you are right, the result must be 68. I don't understand why you are seeing this (all test cases expect "0"), I just checked and everything works fine for me. Probably something wrong with codewars' test runners? Are you using Node v10.x?
What was the callback function?
That example shows that numbers can be repeated, or do you mean something else?
It's generally considered a bad practice if function mutates its parameters passed as input. Otherwise, every time some caller calls your function, they have to assume that after the call parameters are changed or in some way destroyed and cannot be used anymore.
Since the result is not unique the "testing" function don't verify that the arrays are the same but that the result is correctly sorted and that the sum of the squares is correct.