Fibonacci (Memoization + Tabulation)

00:00
EasyDynamic ProgrammingRecursionMemoization
TCSWiproInfosys

Compute nth Fibonacci number using dynamic programming. F(0)=0, F(1)=1, F(n)=F(n-1)+F(n-2). Implement memoization and tabulation.

Examples

Input → n=0
Output → 0
Input → n=1
Output → 1
Input → n=10
Output → 55
Input → n=20
Output → 6765