Tap here to switch tabs
Problem
Submissions

Problem: Number of Substrings With Only 1s

med
30 min
Try to solve the Number of Substrings With Only 1s problem.

Statement

Given a binary string s, return the total number of substrings consisting solely of the character $'1'$. Since the result can be large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s[i] is either $'0'$ or $'1'$.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Substrings With Only 1s

med
30 min
Try to solve the Number of Substrings With Only 1s problem.

Statement

Given a binary string s, return the total number of substrings consisting solely of the character $'1'$. Since the result can be large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s[i] is either $'0'$ or $'1'$.