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.
My solution which is the same as this failed one of the random tests the first time I submitted it. I have no idea why.
I really like this solution :)
Can you share what worked? I can't get this test to pass either. I feel like I'm building an empty list improperly, but I have no idea what an empty list should look like, and I can't get "toArray" to work.
I do not think that this is sufficient, since 'aabbc' and 'abccc' both have length 5 and {'a', 'b', 'c'}
I like this - I would just add spaces like so:
and then I think we are as neat as as we could possibly get
Sadly we can't downvote the best practices... But this solution does not work, and should not be accepted as a proper solution.
This deserves more best practices upvote. It is really better than the set solution, which does not handle duplicated characters.
Works like a charm.
Thanks for the reply. I'll give it another shot.
Nothing has changed in this Kata since the beginning so I'd be surprised that it starts failing now. I have double-checked the batery of tests and they all pass and they all make use of Cons which is defined in the preload section of the Kata. So, there must be something in your code or something failed in Code Wars. I just tried doing the solution again by training on my own Kata and it all worked fine.
Is the test for this kata broken? It seems to not see the Cons constructor in its scope.
Here's the message I get when trying to submit the original, pre-populated code:
[Function: Cons] // I console.logged this to make sure Cons is defined
Kata Test Suite
should transform an array into a list and back again
TypeError: Cannot call method 'toArray' of undefined
at Test.it
at Test.describe
It might make sense to explain that node values could be used to uniquely identify node, since we have to use strings as keys into a set/hash of visited nodes.
You're absolutely right.
This solution should not work with "baconnnnnnnnnnn" and "bacon".
This kata is rather badly worded. It's not checking for monotonic sequences. If that was the case,
[3,2,1]
should returnTrue
as well.It's checking for:
And for that condition,
[0, 1, 0]
is true.Perhaps take it up with the author of the kata?
Loading more items...