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.
Unpublishing as an old kata with low satisfaction rating, unresolved issues, and a close duplicate to exitsting kata.
My C solution passes all the first 60 tests, after the 61st I get the following message:
*** Error in `/home/codewarrior/solution': free(): invalid next size (fast): 0x00000000023bc960 ***
The biggest issue I have is that you want the solver to guess what's in your head. In this case it is woefully inefficient as Fibonacci numbers can be generated in logarithmic time while both bottom up and top down are linear.
On a separate note, there are plenty of recursion and Fibonacci-related katas (e.g., this: https://www.codewars.com/kata/59928e2889d6a01970000051) that test for efficiency. There are also some bottom up vs top down katas; the one that comes to mind is https://www.codewars.com/kata/the-fusc-function-part-2
Is your helper function recursive? Please include your solution so I can see what is happening.
Not really...
I have an efficient, recursive function; I even created a helper function if you really stick to it (
def fib_helper(*args): return
:) But what are you testing?! I get:Believe me, it's recursive!
I think this is quite hard for 4 kyu, but it was fun.
BTW: For very large n the trivial recursive and iterative versions might be too slow, so you might want to consider a non-trivial approach to Fibonacci numbers (see the-millionth-fibonacci-kata).
wait, sorry, i shouldn't have marked this issue as resolved, i didn't really address your question
That test case now specifies that it's testing that the function is recursive. :)
fixed :)
Okay, so what exactly do you expect the helper function to do? You told us to use a helper function but you didn't tell us what it's going to do. All we get is input
fi=377, fj=610, n=3
, andFalse should equal True
in the tests.This comment is hidden because it contains spoiler information about the solution
The other kata asks for simple recursion (top down) which calculates the same value several times, this one asks for botom-up recursion which can calculate the fibonacci element for a higher n. I think it is trying to teach something very different.
There's not really a difference to this one (language doesn't matter): https://www.codewars.com/kata/recursion-number-2-fibonacci
Probably this should be an issue...;-)
For the time being CW times out with every kata I tried...
Loading more items...