Ad
  • Custom User Avatar

    cache is recreated again every time your function is called, that won't work. Google how memoization is done.

  • Custom User Avatar

    Refactor the function into a recursive Fibonacci function that using a memoized data structure avoids the deficiencies of tree recursion

    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.

  • Default User Avatar

    Recursion don't fit for this kata.
    I would to know why my code does not finish while function gives correct results.

  • Custom User Avatar

    Where is the recursion or the memoization? Google to know what those are if you don't know.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution