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
This comment is hidden because it contains spoiler information about the solution
Oh, you're right! Apologies
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.Faster, less memory solution: https://www.codewars.com/kata/5b1b27c8f60e99a467000041/solutions
uses one loop, no objects.
This comment is hidden because it contains spoiler information about the solution
yeah, that's a good point.
I've started to comment my code and even leave in console.logs.
The reason I left them out was to get the code as succinct as possible, but that's just for pride.
way too complicated for the top answer to this tricky kata! I'm pretty proud of mine.
.
Read this: https://docs.codewars.com/training/troubleshooting#print-input
Hi, I'm passing all basic tests and 191 random tests, but I have no idea why I'm failing the others. Can anybody give me a clue ?
Update to Scala 3
Leave it, maybe it helps someone.
Oh right, my bad... even before that block there's this:
Should I delete this thread?
It's explained in the description.
Loading more items...