Solving Longest Palindromic Substring in Javascript. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem Description

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.


Example 1:
Input: "babad"
Output: "bab"

Note: "aba" is also a valid answer.

Example 2:
Input: "cbbd"
Output: "bb"

See the full details of the problem Longest Palindromic Substring at LeetCode

Originally posted at: