Unable to solve

please tell base case and recursive case condition

Logic:
first try to place 0 or 1 at starting and call recursion to slove

now in recursion

// base case:
if (n == K) 
	{ 
		// terminate binary string 
		str[n] = '\0' ; 
		cout << str << "\n"; 
		return ; 
	} 

in recursive case you have to place 0 or 1 and call the recursion again

if previous character is '1' then we put 
only 0 at end of string 
example str = "01" then new string be "010" 

if previous character is '0' than we put 
both '1' and '0' at end of string 
example str = "00" then new string "001" and "000" 

complete code

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning:
if you have more doubts regarding this feel free to ask

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.