_3211

package
v0.0.0-...-5ea41ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 1 Imported by: 0

README

生成不含相邻零的二进制字符串

给你一个正整数 n

如果一个二进制字符串 x 的所有长度为 2 的子字符串中包含 至少 一个 "1",则称 x 是一个** 有效** 字符串。

返回所有长度为 n 的** 有效** 字符串,可以以任意顺序排列。

示例 1:

**输入:**n = 3

输出:["010","011","101","110","111"]

解释:

长度为 3 的有效字符串有:"010""011""101""110""111"

示例 2:

**输入:**n = 1

输出:["0","1"]

解释:

长度为 1 的有效字符串有:"0""1"

提示:

  • 1 <= n <= 18

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL