Return the longest palindromic substring of s: the longest run of consecutive characters that reads the same forwards and backwards. If several have the same length, return the one that starts earliest. An empty string gives "".
The starter code checks every substring. It is correct but too slow. Make it fast.
Example 1
Input:
longest_palindromic_substring('babad')
Output:
'bab'
bab and aba both work; bab starts first.
Example 2
Input:
longest_palindromic_substring('cbbd')
Output:
'bb'
bb.
0 <= len(s) <= 1000s contains lower-case letters.No results yet
Run your code to check it against the examples, or submit to run every test.