Binary string recursion problems

can u once please explain the f(n-2) because if we put one 0 at last then we left with f(n-1) but if we put 1 we are left with f(n-1) but here the caugh is how to decide whether n-1 is zero or one …

hello @Vikaspal
when we put 0 at nth position then there is no restriction
on n-1th position that why we are using f(n-1)

now if we put 1 at nth position then it is mandatory for us to put 0 at n-1 th position (because we can not put 1 at n-1 th position it will lead to two consecutive 1)
due thats why f(n-2)

f(n)=f(n-1 ) (when 0 is place at nth position) + f(n-2) (when 1 is place at nth position)

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.