← Recursion & Backtracking Quiz: all 7 questions
Recursion & Backtracking Quiz · Question 6 of 7
Naive recursive Fibonacci fib(n) = fib(n−1) + fib(n−2) has roughly what time complexity?
Naive recursive Fibonacci fib(n) = fib(n−1) + fib(n−2) has roughly what time complexity?
- A.O(n)
- B.O(n²)
- C.O(2ⁿ)
- D.O(log n)
Answer & explanation
Correct answer: O(2ⁿ)
Each call branches twice and subproblems repeat — that's why memoization (DP) is needed.
Can you get the rest right without peeking?
Take the timed Recursion & Backtracking Quiz quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →