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
Coming from Haskell, I find it hard to use loops (even though I've used JavaScript for two years before learning Haskell). When I started solving katas in JavaScript, I kept on trying to use recursion instead of loops because it was faster. But soon learnt that it's not.
We've got a similar solution 😎
Only thing that's different is that I used
foldl'
instead offoldl
becausefoldl'
tends to be faster and less "lazy".Getting odds and evens swapped? Your list has 2,3,4,5,6 appearing odd number of times, the kata states there will be exactly one that appears an odd number of times. And yes, this trick only works if the input follows the rule.
I've tested this solution out, and if we give a list like
[1, 1, 2, 3, 4, 5, 6]
, I get back 6. If I give it the list[1, 1, 2, 3, 4, 5]
, I get back 0.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
thanks
Not an issue of the kata but a problem in your code. Before posting issues look at the top of the page to see how many people passed the kata (13938 in Python). If this number is high chances are your code is wrong.
Print the input and your output to understand that.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Haskell, right? So it's not as straight-forward as just "printing" because we're outside IO, we have to resort to
unsafePerformIO
.. but there exists a module to help us out a bit. Example:You can see test 5 details and trouble shoot why it is failing.
https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#how-can-i-see-which-input-causes-my-solution-to-fail
You can check it yourself: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#how-can-i-see-which-input-causes-my-solution-to-fail
This comment is hidden because it contains spoiler information about the solution
Loading more items...