Tap here to switch tabs
Problem
Submissions

Problem: Check If a String Contains All Binary Codes of Size K

med
30 min
Try to solve the Check If a String Contains All Binary Codes of Size K problem.

Statement

Given a binary string s and an integer k, return true if every binary code of length k is a substring of s, or false otherwise.

Constraints:

  • 1≤1 \leq s.length ≤5imes105\leq 5 imes 10^5

  • s[i] is either '0' or '1'

  • 1≤1 \leq k ≤20\leq 20

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Check If a String Contains All Binary Codes of Size K

med
30 min
Try to solve the Check If a String Contains All Binary Codes of Size K problem.

Statement

Given a binary string s and an integer k, return true if every binary code of length k is a substring of s, or false otherwise.

Constraints:

  • 1≤1 \leq s.length ≤5imes105\leq 5 imes 10^5

  • s[i] is either '0' or '1'

  • 1≤1 \leq k ≤20\leq 20