Longest Palindromic Substring
Given a string s, return the longest palindromic substring in s.
A palindrome reads the same forwards and backwards, so "bab", "aba", "c", and the empty string all qualify. Given any input string, there is always at least one valid answer: any single character is a palindrome of length one. When two substrings share the maximum length, returning any one of them is accepted.
The classic way to think about palindromes is as mirrors around a center. An odd-length palindrome such as "aba" mirrors around a single character at index 1. An even-length palindrome such as "abba" mirrors around the gap between the two central characters at indices 1 and 2. Every palindrome falls into exactly one of these two categories, and the algorithm that exploits this symmetry is the practical workhorse for the problem.
Longest Palindromic Substring
Given a string `s`, return the longest palindromic substring in `s`.