> For the complete documentation index, see [llms.txt](https://jaywin.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jaywin.gitbook.io/leetcode/solutions/1016-binary-string-with-substrings-representing-1-to-n.md).

# 1016. Binary String With Substrings Representing 1 To N

<https://leetcode.com/problems/binary-string-with-substrings-representing-1-to-n>

## Description

Given a binary string `s` and a positive integer `n`, return `true` *if the binary representation of all the integers in the range* `[1, n]` *are **substrings** of* `s`*, or* `false` *otherwise*.

A **substring** is a contiguous sequence of characters within a string.

**Example 1:**

```
**Input:** s = "0110", n = 3
**Output:** true
```

**Example 2:**

```
**Input:** s = "0110", n = 4
**Output:** false
```

**Constraints:**

* `1 <= s.length <= 1000`
* `s[i]` is either `'0'` or `'1'`.
* `1 <= n <= 109`

## ac

```java
```
