MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / expandCenter

Function expandCenter

palindromic_substrings_647/solution.go:18–27  ·  view source on GitHub ↗

expandCenter returns the number of palindromic strings discovered by expanding around the passed left and right index in the passed string s.

(s string, left, right int)

Source from the content-addressed store, hash-verified

16// discovered by expanding around the passed left and right
17// index in the passed string s.
18func expandCenter(s string, left, right int) int {
19 cnt := 0
20 for left > -1 && right < len(s) && s[left] == s[right] {
21 left--
22 right++
23 cnt++
24 }
25
26 return cnt
27}

Callers 1

countSubstringsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected