Question PSC-FUNC-0074
HardWhat does the following pseudocode print?
Integer memo[50]
Function fib(Integer n)
if (n < 2) return n end if
if (memo[n] != 0) return memo[n] end if
memo[n] = fib(n - 1) + fib(n - 2)
return memo[n]
End Function
Print fib(40)
- A.
1023341550
- B.
63245986
- C.
Sign up free to see the answer and a step-by-step explanation.