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.
forbidden method
Same here.
IDK what you tried, but it passes in less than 2 seconds consistently.
I tried this and it timed out. Probably luck of the draw as to what random tests you get.
maybe its becos the random tests were different
I marked it as clever because I think that the goals of the kata is implement something to cache the function calls, aren't use a something already implemented.
I didn't measure.
Got the time-out error here for n-1 then n-2, but it accepted the other way around.
Not sure why
Are you sure you measured it correctly? There shouldn't be any noticeable difference.
This took more than 12 seconds.
Recursing for n-2 before n-1 worked though
I tried copying this code over onto my Vscode and tried to run in line by line. But it doesn't seem to increase the speed of calculating the fibonacci?
I'm not even able to run fibonacci(50) as it just takes too long to load any answer.
Am i supposed to run the function differently? Reading up on decorators, it seems that running
fibonacci(50) is good enough to have the memoization implemented???
Hope someone can answer this question, thanks.
With default settings I get a RecursionError at
fibonacci(500)
.By increasing the depth limit to at least
sys.setrecursionlimit(4339)
the program will die silently atfibonacci(2169)
.By rewriting the code to use less recursions (without decorators) you could even make it calculate
fibonacci(7860)
.An iterative algorithm however, or something that supports tail recursion, has no problems at all with way higher numbers.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Which is almost always a VERY bad idea.
Loading more items...