You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: leetcode/1501-1600/1513.Number-of-Substrings-With-Only-1s/README.md
+19-13Lines changed: 19 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,34 @@
1
1
# [1513.Number of Substrings With Only 1s][title]
2
2
3
-
> [!WARNING|style:flat]
4
-
> This question is temporarily unanswered if you have good ideas. Welcome to [Create Pull Request PR](https://github.com/kylesliu/awesome-golang-algorithm)
5
-
6
3
## Description
4
+
Given a binary string `s`, return the number of substrings with all characters `1`'s. Since the answer may be too large, return it modulo `10^9 + 7`.
7
5
8
6
**Example 1:**
9
7
10
8
```
11
-
Input: a = "11", b = "1"
12
-
Output: "100"
9
+
Input: s = "0110111"
10
+
Output: 9
11
+
Explanation: There are 9 substring in total with only 1's characters.
12
+
"1" -> 5 times.
13
+
"11" -> 3 times.
14
+
"111" -> 1 time.
13
15
```
14
16
15
-
## 题意
16
-
> ...
17
-
18
-
## 题解
17
+
**Example 2:**
19
18
20
-
### 思路1
21
-
> ...
22
-
Number of Substrings With Only 1s
23
-
```go
19
+
```
20
+
Input: s = "101"
21
+
Output: 2
22
+
Explanation: Substring "1" is shown 2 times in s.
24
23
```
25
24
25
+
**Example 3:**
26
+
27
+
```
28
+
Input: s = "111111"
29
+
Output: 21
30
+
Explanation: Each substring contains only 1's characters.
0 commit comments