Smart keyboard recursion issue

https://ide.codingblocks.com/s/111245 sir, please check and let me know about the required changes.

Hey!
Please check the comments in the following code:

Thanks!

Thanku Sir, but can u tell me the mistake with my code. I mean the recursion part. I can not find out

Hi!
The recurrence relation that you have used is not working fine. That is the reason I suggested that approach, its a bit easier and more efficient.

Yes Sir, I understand that. But actually I am not able to understand recursion properly and I wanted to know where am I making mistakes. So, if you could tell me the mistake in my recursive call, it would be a great help.

I’d advice you to please have a look at the hint that I’ve shared. That should explain you the problem with the recursion in your code.
Thanks!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.