Longest Palindromic Substring
Return the longest contiguous piece of s that reads the same forwards and backwards. If several pieces tie for the longest length, return the one that starts earliest in s.
Example 1
s "babad"
returns "bab"
bab and aba tie; bab starts first.
Example 2
s "cbbd"
returns "bb"
bb.
Constraints
1 <= len(s) <= 50shas letters and digits
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.