Find the longest palindromic substring. The expand-around-center approach is elegant and uses O(1) space.
Each character is a center for odd-length palindromes. Each pair of adjacent chars is a center for even-length palindromes.
💡 Pro tip: Understand this problem deeply — don't just memorize the code. Try explaining the approach out loud as if teaching a friend. If you can explain it simply, you truly understand it!
len(longestPalindrome('babad'))
3