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
The string only contains letters from a to z?
A string also has a length property. Don't need to convert the string to an array with
split()
.Sorry, wil do!
This comment is hidden because it contains spoiler information about the solution
When no value is passed to
reduce()
, like ([]
), where the initial value is 0. The reduce returns it's initial value.What he is saying is that the function is mutating the original signature array.
You should make a copy of the signature array. You can do that with
const aryintSignature_Copy = [...signature]
;Wow, such a clever sollution!
I was breaking my head on excluding those 'edge cases' (
n =< signature.length
) from the loop.What would be a good practice to eliminate overcomplification?
Is it to write all possible inputs and outputs in 1 overview to spot the most efficient pattern?
But thnx, this was a great lesson.
This comment is hidden because it contains spoiler information about the solution
Oke, but what is returned when count_sheep(0) is executed? Not an empty ""...
But where is the logic for handling the '-' and ' ' at the first index and last index of each argument?