Tap here to switch tabs
Problem
Submissions

Problem: Binary String With Substrings Representing 1 To N

med
30 min
Try to solve the Binary String With Substrings Representing 1 To N problem.

Statement

Given a binary string s and a positive integer n, return true if the binary representation of every integer from 11 through n is a substring of s, or false otherwise.

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

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s[i] is either '0' or '1'.

  • 1≤1 \leq n ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Binary String With Substrings Representing 1 To N

med
30 min
Try to solve the Binary String With Substrings Representing 1 To N problem.

Statement

Given a binary string s and a positive integer n, return true if the binary representation of every integer from 11 through n is a substring of s, or false otherwise.

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

Constraints:

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s[i] is either '0' or '1'.

  • 1≤1 \leq n ≤109\leq 10^9