I actually felt decent about the expand-around-center part.
Start by clarifying the problem and edge cases, then implement the expand-around-center approach with separate handling for odd and even centers. After verifying with examples, discuss how Manacher's algorithm achieves linear time by reusing previously computed palindrome radii.
Pro tip: Emphasize that the O(n^2) solution is optimal for many practical cases, but knowing Manacher's algorithm demonstrates depth; however, be prepared to explain why it's rarely used in production due to constant factors and complexity.
Confirm the definition of a palindromic substring (contiguous) and discuss edge cases like empty string, single character, and all identical characters.
Explain that each palindrome has a center (odd: single char, even: between two chars). For each center, expand outward while characters match, counting each valid expansion.
Write pseudocode or code for the O(n^2) solution. Analyze time complexity: O(n^2) due to n centers and O(n) expansion each; space O(1).
Introduce Manacher's algorithm: transform string to handle even palindromes uniformly, maintain rightmost palindrome boundary and center, use symmetry to avoid redundant expansions.
Compare O(n^2) and O(n) approaches: Manacher's is complex and has higher constant factors; O(n^2) is simpler and often sufficient. Mention edge case handling in both.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.