Brute-forcing all substrings takes . The expand-around-center technique drops that to by picking each character as a potential center and growing outward while characters match.
You'll also handle the odd-length vs even-length palindrome distinction, which trips up many people. Amazon asks string manipulation problems often, and this one tests whether you can move beyond brute force to a structured scanning approach. Once you have expand-around-center in your toolkit, palindrome detection becomes mechanical.