is this the correct code for this problem?
Optimal Binary Strings Recursion
I think your base case should be modified a bit.
it prints 1 when n=0 which is wrong and should print 0.
Modify ur base case to
if(n<=0)
return 0;
if(n<=2)
return n+1;