Why do we check both odd and even centers?
Practice this question from Longest Palindromic Substring - Expand around center Pattern Practice Quiz, with options and an explanation.
Question
Why do we check both odd and even centers?
Option A — Correct answer
Because even palindromes have a center between characters
Option B
Because all palindromes have odd length
Option C
Because indexes must be even
Option D
Because sorting needs it
Explanation
Even-length palindromes have a center between two characters.