When to use Recursion

This lesson covers all the factors of when you should use Recursion.

Ever wonder why programming languages such as Haskell, Scala, JavaScript, etc are so in demand nowadays? This is because these languages are based on Functional Programming, meaning the system is built around the concept of recursion. Entire languages are now being based on recursion. Interesting, right?

In general, almost any problem that can be solved with a non-recursive code can also be solved by recursion. In fact, most problems that can’t be solved by a non-recursive code can even be solved by recursion. This doesn’t mean, however, that you should always use recursion to solve the problem. This is exactly what we will be discussing in this lesson.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.