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.
In Haskell version, I don't know what the original problem is, but at least from reading the problem statement, I think that when the input
Just [0]
is given in a random test, the answer should be[0, 0]
(the above code would give[]
as the answer). BecauseJust [0]
is neitherNull
norEmpty
, it shouldn't return an empty list (and I've been hitting random tests like this).You're right, I was out of touch with the two test cases. I've rewritten the code to calculate up to
fib 10000
. OCaml is a bit strict with numbers, so I'd rather not write something like that ;).Personally, I think recursive memoization is one approach to dynamic programming (compute from before or after), but I'll consider the dynamic programming approach too!