1461. Check If a String Contains All Binary Codes of Size K
https://leetcode.com/problems/check-if-a-string-contains-all-binary-codes-of-size-k
Description
Given a binary string s
and an integer k
.
Return true
if every binary code of length k
is a substring of s
. Otherwise, return false
.
Example 1:
Example 2:
Example 3:
Example 4:
Example 5:
Constraints:
1 <= s.length <= 5 * 105
s[i]
is either'0'
or'1'
.1 <= k <= 20
ac
Last updated