5. Longest Palindromic Substring

Description

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

Constraints

Approach

Examples

Input: "babad"

Output: "bab"

Note: "aba" is also a valid answer.

Solutions

Follow up

  • Longest substring of vowels - GFG

  • Longest Non-palindromic substring - GFG

Last updated

Was this helpful?