Available question text
Count the number of substrings of a binary string s such that either the number of 0s or the number of 1s in the substring is ≤ k. With n ≤ 50 this can be solved by enumerating substrings and using prefix counts or a two-pointer scan to check the k-constraint efficiently.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 3258. Count Substrings That Satisfy K-Constraint I
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source