Skip to content

Commit 14d7a42

Browse files
committed
Create README - LeetHub
1 parent 7428d14 commit 14d7a42

File tree

1 file changed

+36
-0
lines changed
  • 1636-number-of-substrings-with-only-1s

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<h2><a href="https://leetcode.com/problems/number-of-substrings-with-only-1s">1636. Number of Substrings With Only 1s</a></h2><h3>Medium</h3><hr><p>Given a binary string <code>s</code>, return <em>the number of substrings with all characters</em> <code>1</code><em>&#39;s</em>. Since the answer may be too large, return it modulo <code>10<sup>9</sup> + 7</code>.</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong class="example">Example 1:</strong></p>
5+
6+
<pre>
7+
<strong>Input:</strong> s = &quot;0110111&quot;
8+
<strong>Output:</strong> 9
9+
<strong>Explanation:</strong> There are 9 substring in total with only 1&#39;s characters.
10+
&quot;1&quot; -&gt; 5 times.
11+
&quot;11&quot; -&gt; 3 times.
12+
&quot;111&quot; -&gt; 1 time.</pre>
13+
14+
<p><strong class="example">Example 2:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> s = &quot;101&quot;
18+
<strong>Output:</strong> 2
19+
<strong>Explanation:</strong> Substring &quot;1&quot; is shown 2 times in s.
20+
</pre>
21+
22+
<p><strong class="example">Example 3:</strong></p>
23+
24+
<pre>
25+
<strong>Input:</strong> s = &quot;111111&quot;
26+
<strong>Output:</strong> 21
27+
<strong>Explanation:</strong> Each substring contains only 1&#39;s characters.
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
<p><strong>Constraints:</strong></p>
32+
33+
<ul>
34+
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
35+
<li><code>s[i]</code> is either <code>&#39;0&#39;</code> or <code>&#39;1&#39;</code>.</li>
36+
</ul>

0 commit comments

Comments
 (0)