#3234

Count the Number of Substrings With Dominant Ones

medium · 42.1% accepted · 632 likes · top 23%

string · enumeration

⊣ practice⊣ open on leetcode ↗

Description

You are given a binary string s.

Return the number of substrings with dominant ones.

A string has dominant ones if the number of ones in the string is greater than or equal to the square of the number of zeros in the string.

Solution