Find the longest palindrome using expand-around-center approach
Every palindrome has exactly one center (odd-length: a character, even-length: between characters). By expanding from each center until mismatch, we enumerate all maximal palindromes. The worst case occurs with strings like "aaa...a" where every expansion reaches the boundaries.
Manacher's algorithm achieves O(n) by exploiting palindrome symmetry—if we're inside a known palindrome, we can reuse expansion lengths from the mirrored position.
Unlike DP approaches that store an n×n table of palindrome states, expand-around-center computes each palindrome on-the-fly. We only track the best result found, not intermediate states. The algorithm is also "online" in that we can process characters incrementally.
The O(n²) DP solution uses O(n²) space for the memoization table. Expand-around-center trades time efficiency (same O(n²)) for optimal O(1) space.