(s string, left int, right int)
| 97 | } |
| 98 | |
| 99 | func expandAroundCenter(s string, left int, right int) int { |
| 100 | // The left and right values are either: |
| 101 | // - equal |
| 102 | // - right = left + 1 |
| 103 | |
| 104 | // while left is greater than -1 and |
| 105 | // right is less than the length of s and |
| 106 | // s[left] is equal to s[right]. |
| 107 | for left > -1 && right < len(s) && s[left] == s[right] { |
| 108 | left-- |
| 109 | right++ |
| 110 | } |
| 111 | |
| 112 | // return the length of the palindromic expansion (i.e., units from |
| 113 | // center being the passed left and right) about the center. |
| 114 | return right - left - 1 |
| 115 | } |
no outgoing calls
no test coverage detected