We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e7e5e2b commit 15a60edCopy full SHA for 15a60ed
palindromic-substrings/printjin-gmailcom.py
@@ -0,0 +1,15 @@
1
+class Solution:
2
+ def countSubstrings(self, s):
3
+ count = 0
4
+ for center in range(len(s)):
5
+ left, right = center, center
6
+ while left >= 0 and right < len(s) and s[left] == s[right]:
7
+ count += 1
8
+ left -= 1
9
+ right += 1
10
+ left, right = center, center + 1
11
12
13
14
15
+ return count
0 commit comments