Computer Science, Mathematics, Learning, Learning To Code, Code.
n-1 and n-2. Once we get to a base case, we return the values back up the call stack. An example of returning values up the call stack: for fib(2) = fib(1) + fib(0), we get 1 + 0 = 1. Therefore fib(3) = fib(2) + fib(1) = 1 + 1 = 2. As we can see, we need to know the answer of smaller recursive