Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
If we have a string <code>s</code> of length <code>x</code>, we can generate all strings of length <code>x + 1</code>.
If <code>s</code> has 0 as the last character, we can only append 1, whereas if the last character is 1, we can append both 0 and 1.
We can use recursion and backtracking to generate all such strings.