Discover Packages
github.com/awesee/leetcode
problems
binary-string-with-substrings-representing-1-to-n
package
Version:
v1.6.6
Opens a new window with list of versions in this module.
Published: Nov 27, 2021
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
< Previous
Next >
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
[String ]
Hints
Hint 1
We only need to check substrings of length at most 20, because 10^6 has 20 bits.
Expand ▾
Collapse ▴
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.