Skip to content

Commit 4383bf1

Browse files
committed
Do daily
1 parent b659d5d commit 4383bf1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

my-submissions/m1358.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution:
2+
def numberOfSubstrings(self, s: str) -> int:
3+
a = b = c = -1
4+
output = 0
5+
6+
for i, x in enumerate(s) :
7+
match x :
8+
case 'a' :
9+
a = i
10+
case 'b' :
11+
b = i
12+
case 'c' :
13+
c = i
14+
15+
if min(a, b, c) != -1 :
16+
output += 1 + min(a, b, c)
17+
18+
return output

0 commit comments

Comments
 (0)