Grokking the Art of Recursion for Coding Interviews
Vote

0% completed

16. Fibonacci Series Using Memoization

Problem Statement

Print Fibonacci Series Using Memoization and Recursion.

Given a positive integer n, print the Fibonacci series up to the nth term using memoization and recursion.

Examples:

Sr#InputOutputExplanation
150, 1, 1, 2, 3The Fibonacci series up to the 5th term is 0, 1, 1, 2, 3

.....

.....

.....

Like the course? Get enrolled and start learning!
Dan Anderson

Dan Anderson

· 4 months ago

Two issues with this problem:

  1. The examples are off by 1 relative to the expected output. E.g. For n = 5, the output expects [0,1,1,2,3,5] which is different than the [0,1,1,2,3] shown in the examples.
  2. The example solution on the next page returns the nth Fibonacci number, not the series which is required by this problem.