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 should fail, it will incorrectly judge the string
"abbb"
Your list comprehension can be replaced by
replicateM 4 perms
Works, thanks!
This line:
[ '(1|((1&(0^1))&(0&0)))' ]
is in your list 3 times, there are probably more duplicates.
In C++, the random test cases include tests with empty words (length 0). This is not expected, given the description, and worse, the answer is expected to be false, while the straightforward implementation will answer true.
It took me a while to figure out why my perfect solution was being rejected.
I also own a 4x4x4 snake cube, and also couldn't solve it. A few years back i wrote a Haskell program to solve it, i could reuse my code today. :) Thanks for making this.
Needs better test cases, at first i didn't read the assignment well, and i made a solution that only checks for occurance of 'n' and 'B', but does not check for the same index. It was accepted anyway.
An O(n) solution is still feasable, the Haskell version even tests this way.
To counter this, why not set the upper limit to 10^9 instead of 10^6?
Or even 10^10000, it still will be really fast with the right code.
Agree that
== True
should be left of, but i like the style otherwiseThe random test cases need slightly more precision, or higher accepted error. I got this failure on my first try:
Expected actual value 1.8743956307381016e-3 to approximately equal expected value 1.8743983442063511e-3 (accepted relative error: 1.0e-6) (after 64 tests): -6.279467554143704 30
I tried the same code a second time, then it worked.
head . sort... now that you mention it, i feel bad :)
on the other hand, sort is a lazy merge sort, so it's still linear time, if a bit convoluted...
I deleted a line and it will works :)
I feel this Kata is too similar to Almost Even
In stead of implementing
safeHead
yourself, you can uselistToMaybe
from Data.Maybe.I like your name better though.
Confirmed, thanks!
Loading more items...