MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / countSubstrings

Method countSubstrings

python/0647-palindromic-substrings.py:2–8  ·  view source on GitHub ↗
(self, s: str)

Source from the content-addressed store, hash-verified

1class Solution:
2 def countSubstrings(self, s: str) -> int:
3 res = 0
4
5 for i in range(len(s)):
6 res += self.countPali(s, i, i)
7 res += self.countPali(s, i, i + 1)
8 return res
9
10 def countPali(self, s, l, r):
11 res = 0

Callers

nothing calls this directly

Calls 1

countPaliMethod · 0.95

Tested by

no test coverage detected