Count Binary Substrings

Given a binary string s, return the number of non-empty (contiguous) substrings that satisfy the following criteria: each 0 or 1 in these substrings appears the same number of times. For example, for ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: