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.
That fixed test added. Solution should be invalidated now.
+1 for changing output type to
Integer
.I've cheated here writing actual
hamming
signature asInt -> Integer
and it passed all tests anyway so there are no overflows in the testing environment. But the Haskell translation of the kata should be definitely changed because Haskell standard guarantees only thatInt
values are at least in [-2^29 ... 2^29-1] andhamming 5000
is greater that 2^45.My solution calculates factorization for 4000! (it is the highest
n
in the description) in 78 milliseconds on the local machine. Have no idea why I get timeout here on Codewars (which is 12 sec).This solution is bad, Int overflow may happen when
iterate
over powers.This comment is hidden because it contains spoiler information about the solution