Use of for loop

in the video, you have used for loop, but we are not supposed to use loops in recursion.

@apoorvsingh27,

Let’s say the string is abcd.

Now the result of this will be a + subsequences(bcd).
Answer of bcd will be b + subsequences(cd).
Answer of cd will be c + subsequences(d).
Answer of subsequences(d) will be d + subsequences(""), this is where we hit our base case and return arraylist with “” (empty string).

We are using loop to add elements to the arraylist. We use recursion to break down the string from “abcd” to “d” and finally hit the base case.

Recursion is used to divide the problem into smaller fractions.

The for loop is only used for final computation.