#3844

Longest Almost-Palindromic Substring

medium · 22% accepted · 140 likes · top 2%

two pointers · string · dynamic programming

Description

You are given a string s consisting of lowercase English letters.

A substring is almost-palindromic if it becomes a palindrome after removing exactly one character from it.

Return an integer denoting the length of the longest almost-palindromic substring in s.

Solution