Recursive solution to finding patterns
- by user2997162
I was solving a problem on recursion which is to count the total number of consecutive 8's in a number. For example:
input: 8801 output: 2
input: 801 output: 0
input: 888 output: 3
input: 88088018 output:4
I am unable to figure out the logic of passing the information to the next recursive call about whether the previous digit was an 8.
I do…