Understanding a Recursive Problem
In this lesson, we'll learn methods to understand and visualize a recursive function.
We'll cover the following...
Understanding the Problem
In the previous lessons, we learned the basic concept of recursion, what it is and when it can be used. Now, we will discuss how recursion works.
Let’s have a look at an example. The code below prints a pattern, that subtracts from the targetNumber
until we reach a negative number or . Then we add until we reach the targetNumber
again.
For example:
If targetNumber
...
Access this course and 1400+ top-rated courses and projects.