Longest Palindromic Substring (LeetCode 5): return the longest palindromic substring of a string.
Asked in the Round 1 technical stage. Given after resume discussion; candidate notes it is a standard DP problem.
Implement longest_palindrome(s). The input is a non-empty string. Return its longest palindromic substring. If multiple substrings have the maximum length, return the one with the smallest starting index.
def longest_palindrome(s):