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 fault, I took the requirement literally even if it was clearly a waste of CPU time
Thank you
lol, after getting rejected many times for lack of speed I came up with this monstruosity
It's faster than most,but don't think it's worth the extra complexity. Also I think it can be made even faster and simpler with ST
Love this one from donaldsebleung, taught me lots about maps: https://www.codewars.com/kata/reviews/5a086e50d87df7e3ca000083/groups/5a7ecbb7dc8ae467d1000647
The tests are correct. You are very likely having a performance issue in your solution.
If you can't solve your problem by following the Troubleshooting Guide, post your code, properly marked up and spoilered, and people can have a look.
Random tests are 40 times 20 - 300 and 20 times 300 - 4000 BTW.
GHC 8.2
ran a lot slower than the newGHC 8.8
; using that might also help ( though setup time has gone from 2 to 3 seconds unfortunately ).I guess you run out of digits. Floating point breaks pretty soon with factorial
i dont think its computed on ur computer but actually code wars servers. My solution does it for 4000! 40 times in under 5 in IntelliJ but it times out when i submit
My haskell solution works for the test, but always fails submission.
Thought of a performance issue, but doubt it: on my (beefy) laptop does 1000 in about 4 ms, 10000 in about 340 (10000! has 35660 digits)
Wonder if the property based testing is longer than the platform allows
It's a math precision issue. This is about integer arithmetics, floating point doesn't work.
2^31 * 17^2 * 969743 * 25772783 = 15511210043330986055303168
25! = 15511210043330985984000000 = 2^22 * 3^10 * 5^6 * 7^3 * 11^2 * 13 * 17 * 19 * 23