#3211

Generate Binary Strings Without Adjacent Zeros

medium · premium · 88.3% accepted · 281 likes · top 99%

string · backtracking · bit manipulation

⊣ practice⊣ open on leetcode ↗

Description

You are given a positive integer n.

A binary string x is valid if all substrings of x of length 2 contain at least one "1".

Return all valid strings with length n, in any order.

Solution