Given a string s, return the longest palindromic substring in s.
Input: s = "babad"
Output: "bab"
Explanation: "aba" is also a valid answer.
Input: s = "cbbd"
Output: "bb"
1 <= s.length <= 1000s consist of only digits and English letters (lower-case and/or upper-case).When the function longestPalindromicSubstring is called with the given example inputs, the expected outputs are:
"babad", the output is "bab" or "aba"."cbbd", the output is "bb".These outputs represent the longest palindromic substrings in the provided strings.
console.log(longestPalindromicSubstring('babad')); // Output: 'bab' or 'aba'
console.log(longestPalindromicSubstring('cbbd')); // Output: 'bb'
Memory: 0
CPU: 0