Longest Palindromic Substring Problem
Longest Palindromic Substring Problem — ExecCode Medium DSA Practice
Solve the Longest Palindromic Substring problem on ExecCode. Free online medium DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Given a string s, return the longest palindromic substring in s. A palindrome reads identically forwards and backwards, and when several substrings tie for the longest length, returning any one of them is accepted.
Examples
Input s = "abaxyzzyxf"; Output "xyzzyx". Input s = "forgeeksskeegfor"; Output "geeksskeeg". Input s = "bananas"; Output "anana"
Constraints
1 ≤ s.length ≤ 1000 s consist of only digits and English letters
Practice Longest Palindromic Substring free on ExecCode. Browse DSA problems, topic map, and placement guides.