Unable to solve

what is the base case? what is the logic here?

hello @amit0001

base case should be ->
if n==1 then return 2 ( 0 or 1 both )

if n==2 then return 3 (00,01,10 these three)

and for n>2
u can use recurrence relation .

okay

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.

Why are we returning 1 if n==0? If string length is 0, then there should be no binary string at all, isn;t it?

it is done to make implementation easy.
if u have issue then refer above base cases