What is the optimized center-expansion idea?
Practice this question from Longest Palindromic Substring - Expand around center Pattern Practice Quiz, with options and an explanation.
Question
What is the optimized center-expansion idea?
Option A — Correct answer
Expand outward from odd and even centers
Option B
Sort the string and return the middle
Option C
Use a queue for every character
Option D
Only count character frequencies
Explanation
Every palindrome has a center, so expand outward from odd and even centers.