Longest palindromic substring
Mediumstringtwo pointersdynamic programming
Return the longest contiguous part of s that reads the same both ways. If several have the same length, return the one that starts first.
Example 1
Input: s = "babad" Output: "bab"
bab and aba tie; bab starts first.
Example 2
Input: s = "cbbd" Output: "bb"
Constraints
- 1 ≤ s.length ≤ 1000
- Lowercase letters and digits
Submit checks your solution against 9 tests, including hidden ones.
/**
* @param {string} s
* @return {string}
*/
function longestPalindrome(s) {
}