Recursion dictionary order


hey what is mistake in this code it is showing error

Hello @Dhruv-Miglani-2090236747707980,

You have missed a very important part of recursion, i.e. the base condition
A recursive function is a function that calls itself until a “base condition” is true, and execution stops.

In your case, even if the if-statement satisfies, the function keeps on calling itself.
Solution:
write a return statement inside the if-condition to break further execution.

Hope, this would help.

still no output .
can you correct the code

I can correct it.
But, this way you are not going to learn to find logic, when stuck.

I would suggest you to try it yourself first.
May be the logic you are applying is inappropriate.

But, how would you get to know about this?
Solution:
Dry run your code on the sample input given in the question.
This will help you to understand the flow of your code.

Do the needful modifications.
In case, you cannot find any way out(but only after trying hard), share your modified code along with a brief about the logic you are implementing.

Hope, this would help.

i am not able to do please help

Sure,

Let’s do this step by step. So that you can understand your mistakes.

First modify your code as mentioned in the comments:

Send the modified code.
BTW, is it Recursion dictionary order(larger) or Recursion dictionary order(smaller)?

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.