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
That's because all sample tests have at least 1
'z'
.Read again how to format the output (just in case, I can't see if the spacing is ok because you didn't use markdown formatting). And yes, the problem is with the trailing
\r
in some cases where there is no'z'
.Language? Check your output doesn't end with a
\r
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Try it with a single for loop. Right now, you're looping through each character in
input
twice, effectively making the function take n^2 steps to resolve, wheren
is the length of input. e.g. If you do this with a string of 10,000 letters, it will take 100,000,000 steps to resolve.