Having problem in coding part

sir, I was having problem in the recursion and sharing the recursion tree and code .

please mention the name of the problem or problem statement too.

In a mathematics class, Teacher ask Alice to find the number of all n digit distinct integers which is formed by the two distinct digits ai and bi but there is a rule to form n digit integer. Rule: She has to form n digit integer by using two digits ai and bi without consecutive bi. Alice is very weak in maths section. Help her to find the number of such n digit integers. Input Format The first line contains T, the number of test cases. Further T lines contains the value n which is the number of digit in the integer.

your recursion tree is right, what issue are you getting in it, is it with the code?

Yes sir i am getting compilation error

Sir I am not able to think about the recursive code and getting confused when to call the function

see now ->

Sir where should i put the count ?


arrange op format accordingly

sir why we did not initialise the count variable globallu?

we did initialised it globally do you want to ask why we did that? if so , then it’s because while doing a recursive call we don’t want out variable cnt to change it’s value. We can also do it locally but then you have to pass the cnt as pass by reference method.

Sir I am having a general doubt regarding code forces , should I start solving long month challeneg

or should I wait and start doing them after completing graphs ,dp ,stacks,ques?

Start as soon as possible.

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.