Class Solution

  • All Implemented Interfaces:

    
    public final class Solution
    
                        

    1016 - Binary String With Substrings Representing 1 To N\.

    Medium

    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'.

    • <code>1 <= n <= 10<sup>9</sup></code>

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Solution()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Boolean queryString(String s, Integer n)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait