#3211

Generate Binary Strings Without Adjacent Zeros

pupil · 390 · lc medium +24 · premium · 88.3% accepted · 281 likes · top 99%

Description

You are given a positive integer n.

A binary string is valid if every length-2 substring contains at least one '1'.

Return all valid binary strings of length n in any order.

Code

1
2
3