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.
I guess we need better tests :D
clever :)
Nice! I didn't know about that. Powerful s#*t !
There are a lot of loops in this solution, but it's clever overall. I believe you can simplify it by returning:
instead of:
Actually, it's not a 100% duplication, and not a duplication at all (at least not intentionally). The kata you're referring to may look similar, but it's completely different.
My kata is much easier, and the argument is always a repetition of the specific string
abab
without any letter repetitions. What I mean is, my tests are always in the form ofabcabc
, notabcb
. That's why it's easier to solve, and I definitely don't consider it a duplication. I can mention the kata you're referring to in the description as an example of a similar but harder kata.resolved
I have added random tests.
This is very easy to read. And I guess this is nice practice to write easy-to-read code :)
so do you mean that I can do something like this:
[...new Set(a), ...new Set(b)]
insted of[...[...new Set(a)], ...[...new Set(b)]]
?[...'abc'] in this case is similar to 'abc'.split('')
The quantity of code lines isn't a concern! 😄 What matters most is clarity and readability.
I'm confident you're aware, but achieving the same result can be done more efficiently using a single loop, specifically utilizing the 'reduce' function. There's no need for the additional 'map' operation.
I'm confident you're aware, but achieving the same result can be done more efficiently using a single loop, specifically utilizing the 'reduce' function. There's no need for the additional 'map' operation :)
tbh you dont need to do it in two separate loops, you can do this in two if statement in one loop, one after another :)
clever solution !
Loading more items...