1.

Which of the following problems can’t be solved using recursion?(a) Factorial of a number(b) Nth fibonacci number(c) Length of a string(d) Problems without base caseThe question was asked in an online interview.My doubt stems from Recursion topic in division Recursion of Data Structures & Algorithms II

Answer»

The correct answer is (d) Problems without base CASE

To EXPLAIN: Problems without base case leads to infinite recursion call. In general, we will assume a base case to avoid infinite recursion call. Problems LIKE FINDING Factorial of a number, Nth FIBONACCI number and Length of a string can be solved using recursion.



Discussion

No Comment Found

Related InterviewSolutions