Skip to content

Commit da32e17

Browse files
committed
feat: Solve palindromic-substrings problem
1 parent e31317f commit da32e17

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

palindromic-substrings/hu6r1s.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution:
2+
"""
3+
4+
"""
5+
def countSubstrings(self, s: str) -> int:
6+
cnt = []
7+
for i in range(len(s)):
8+
for j in range(i, len(s)):
9+
sub = s[i:j+1]
10+
if sub and sub == sub[::-1]:
11+
cnt.append(sub)
12+
return len(cnt)

0 commit comments

Comments
 (0)