Data Structures & AlgorithmsModerateTCS NQT · recursion
Problem: Which operation is the bottleneck of the naive recursive Fibonacci algorithm?
- A. Multiplying large integers
- B. Reading the input
- C. Recomputing the same subproblems exponentially many times
- D. Printing the output
Correct answer: C. Recomputing the same subproblems exponentially many times
The call tree repeats subproblems, so memoisation or iteration reduces the cost to linear.
More Coding Interview Problems questions
- Problem: What is the worst-case complexity of Heapsort on n elements?
- Problem: What is the property of a 'Monge' matrix that enables fast DP optimisation?
- Problem: Which problem is classically solved by the 'convex hull trick' in DP with linear functions?
- Problem: What is the cost of inserting into a binary search tree that is perfectly balanced with n nodes?
- Problem: Which concept explains why the smallest enclosing circle is determined by at most three boundary points?
- Problem: Which statement about the Hungarian algorithm's time complexity is correct for an n x n assignment problem?