Jul 18, 2024
fib(n) calculates the nth Fibonacci number.fib(1) = 1, fib(2) = 1fib(n) = fib(n-1) + fib(n-2)n due to repetitive calculations.fib(50)).fib(6)).m x n grid.m or n is 0 (returns 0), or 1x1 grid (returns 1).(m,n) pairs to avoid redundant work.(i,j) contains the number of ways to get to that cell.(1,1) as 1.table[i][j] = table[i-1][j] + table[i][j-1].False and set table[0] = True as base case.None, except for table[0] which is an empty array.None, except for table[0] which is an empty array.