Question DSA-DP-0004
EasyWhat is the time complexity of computing the n-th Fibonacci number with DP?
- A.
O(2ⁿ)
- B.
O(n²)
- C.
Show answer and explanation
Answer: C
Each value from 2 to n is computed once from the previous two.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Dynamic Programming question
What is the time complexity of computing the n-th Fibonacci number with DP?
O(2ⁿ)
O(n²)
Answer: C
Each value from 2 to n is computed once from the previous two.
O(n)
O(log n) only