less than 1 minute read

Given a string s, return the length of the longest palindromic substring.

Constraints

  • n ≤ 1,000 where n is the length of s

https://binarysearch.com/problems/Longest-Palindromic-Substring

Examples

Example 1

Input

  • s = mactacocatbook

Output

  • answer = 7

Explanation

“tacocat” in the middle is the longest palindromic substring.

Solution

Leave a comment