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.
cache
is recreated again every time your function is called, that won't work. Google how memoization is done.A simple recursive solution won't work, a recursive solution that uses memoized data will work, and that's what the kata is about.
Your solution doesn't work because it's too slow when called several times in a row, it always calculates all Fibonacci numbers until the nth one.
Recursion don't fit for this kata.
I would to know why my code does not finish while function gives correct results.
Where is the recursion or the memoization? Google to know what those are if you don't know.
This comment is hidden because it contains spoiler information about the solution