(s, left, right)
| 35 | }; |
| 36 | |
| 37 | const getLength = (s, left, right) => { |
| 38 | const canExpand = () => 0 <= left && right < s.length; |
| 39 | const isSame = () => s[left] === s[right]; |
| 40 | |
| 41 | const isPalindrome = () => canExpand() && isSame(); |
| 42 | while (isPalindrome()) { |
| 43 | left--; |
| 44 | right++; |
| 45 | } /* Time O(N) */ |
| 46 | |
| 47 | const window = right - left - 1; |
| 48 | |
| 49 | return window; |
| 50 | }; |
no test coverage detected