3258. Count Substrings That Satisfy K-Constraint I
You are given a binary string
sand an integerk.A binary string satisfies the k-constraint if either of the following conditions holds:
- The number of
0‘s in the string is at mostk.- The number of
1‘s in the string is at mostk.Return an integer denoting the number of substrings of
sthat satisfy the k-constraint.
1 | class Solution { |