Given a string s
, find the longest substring that is a palindrome.
Rules:
Constraints:
Examples:
// Example 1: console.log(longestPalindrome("ababd")); // Output: "bab" // Explanation: "aba" would also be valid // Example 2: console.log(longestPalindrome("abbc")); // Output: "bb" // Explanation: Only palindrome of length 2