#3258
Count Substrings That Satisfy K-Constraint I
newbie · 205 · lc easy +16 · 78.9% accepted · 176 likes · top 90%
Description
You are given binary string s and integer k. A binary string satisfies the k-constraint if its count of 0s is at most k OR its count of 1s is at most k.
Return the total number of substrings of s that satisfy the k-constraint.
Code
1
2
3