The Base Case for the solution

The base case should be this
if(n == 1 && last == 1)return 1;

if(n == 1 && last == 0)return 2;

Correct me if i am wrong.

@S18ML0001
correct. . . . . .

1 Like

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.