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.
Some potentially helpful reading: https://docs.codewars.com/training/troubleshooting#maxbuffer
haha 😆. Which language did you do?
I had a hunch that this kata could be solved very quickly and elegantly in Prolog, so for that reason I've authored a Prolog translation!
This is my first time translating (and actually publishing) a CodeWars challenge, so please be kind with my efforts. I think SWI-Prolog runs a touch slower in this case than, for example, Haskell, so I've kept the number of random trials quite low. Let me know if I've done well.
(To be safe, I think I'll just double-check everything I've done after making a quick cup of tea 😃)
It's a really good one for a speed challenge. You can see some of the users above struggling to get their code working fast enough even for this one!
This comment is hidden because it contains spoiler information about the solution
why can't we mutate the input? I tested the code outside of codewars and it worked fine, but I get errors for all the results based on the tests.
based
I don't really understand the need for the isinstance(i, bool) thing. Is it accounting for some contingency I'm not thinking of?