<p>Given a binary string <code>s</code> and a positive integer <code>n</code>, return <code>true</code><em> if the binary representation of all the integers in the range </em><code>[1, n]</code><em> are <strong>substrings</strong> of </em><code>s</code><em>, or </em><code>false</code><em> otherwise</em>.</p>

<p>A <strong>substring</strong> is a contiguous sequence of characters within a string.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> s = "0110", n = 3
<strong>Output:</strong> true
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> s = "0110", n = 4
<strong>Output:</strong> false
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length &lt;= 1000</code></li>
	<li><code>s[i]</code> is either <code>&#39;0&#39;</code> or <code>&#39;1&#39;</code>.</li>
	<li><code>1 &lt;= n &lt;= 10<sup>9</sup></code></li>
</ul>

class Solution:
    def queryString(self, s: str, n: int) -> bool:
        seen = set()
        for size in range(1, 33):
            print('__________________')
            print(f'size: {size}')
            if size > len(s):
                break
            init = 0
            for i in range(size):
                init *= 2
                init += s[i] == '1'
            seen.add(init)
            print(f'init: {init}')
            for r in range(size, len(s)):
                lostChar = s[r - size]
                if lostChar == '1':
                    # init //= 2
                    init -= (2**(size-1))
                init *= 2
                if s[r] == '1':
                    init += 1
                seen.add(init)
                print(f'slid, init now: {init}')
        print(f'seen: {seen}')
        seen.discard(0)
        return all(
            x in seen for x in range(1, n + 1)
        )
17900