Dsa
Dynamic Programming
Easy
Longest Palindromic Substring Length
Given a string, you need to determine the length of the longest palindromic substring within it. A palindromic string is one that reads the same forwards and backwards. Use dynamic programming to solve the problem, and write a program that reads input and prints the length of the longest palindromic substring.
Input format:
- A single line containing the string (1 <= length <= 1000, no spaces).
Output format:
- An integer indicating the length of the longest palindromic substring.
Example:
Input:
abcbad
Output:
3
Key concepts
dynamic_programmingstrings
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now