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
You just linked the general solution page. I think you wanted to link your solution instead.
Your solution includes multiple loops, just not by yourself but by called functions.
includes()
,indexOf()
,slice()
and string concatenation all loop over the strings again and again and also create new string objects every time. Since you call them in a loop your solution is O(n²) while this solution loops over each string exactly once and once over the stack, which contains at most 26 elements.Leave it, maybe it helps someone.
It's explained in the description.
A person of principles (+1 for not using eval ^^)