🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.O(n)
  2. B.O(n²)
  3. C.O(2ⁿ)
  4. 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 →