30:00
Given a binary string s and an integer k, return true if every binary code of length k appears as a substring of s, and false otherwise.
1≤s.length≤5×1051 \leq s.\text{length} \leq 5 \times 10^51≤s.length≤5×105
s[i] is either '0' or '1'.
s[i]
1≤k≤201 \leq k \leq 201≤k≤20
Run code to see results.
There are 2^2 = 4 different binary codes of length 2. Every one of them must show up in s.
s, window of k = 2
0
1
2
3
4
5
6
7
codes seen
0 / 4
Given a binary string s and an integer k, decide whether all 2^k binary strings of length k appear in s as substrings.