Longest Palindromic Substring
Hard · Strings
Write a function longestPalindrome that returns the longest substring of s that reads the same forwards and backwards.
If there are several with the same length, return the one that starts first. For an empty string return "". Compare characters exactly (case-sensitive).