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.
@g964:
You can.
runhaskell Main.hs
and/orghc --make Main.hs && ./Main
will always have a greater overhead thanpython main.py
, since GHC compiles everything and loads its RTS.That's bogus. Given that your hidden tests use
1200 * x
, wherex
is an arbitrary positive integer, it's rather likely that QuickCheck will generate several values that are larger than 83. Also, Python has only 25 random tests, where Haskell has 100.It is easy. Even a O(n) implementation will succeed. However, a O(2^n) implementation is guaranteed to fail.
@TheEndIsNear: Add a test case for 100000 to your own test cases. Check whether your algorithm still completes in 21ms.
Look at the post below, you will understand that your code in Python isn't fast enough. You can't compare the time between different languages at Codewars. Maybe Haskell is rather lengthy to begin but when it has begun, it goes faster... Who knows? Another possibility: the Haskell tests are a bit less difficult than the Python tests because Python is usually fast.
Anyway it's not a Kata issue, it's an issue of your coding. Better the calculation of your Fibonacci and you'll succeed.
PS: I think this kata is not an easy one because of big numbers.