Ad
  • Custom User Avatar

    @g964:

    You can't compare the time between different languages at Codewars.

    You can. runhaskell Main.hs and/or ghc --make Main.hs && ./Main will always have a greater overhead than python main.py, since GHC compiles everything and loads its RTS.

    The Haskell tests are a bit less difficult than the Python tests because Python is usually fast.

    That's bogus. Given that your hidden tests use 1200 * x, where x 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.

    PS: I think this kata is not an easy one because of big numbers.

    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.

  • Custom User Avatar

    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.