Dsa
Dynamic Programming
Easy
Longest Palindromic Subsequence
Given a string, find the length of the longest palindromic subsequence in it. Implement a function that takes a string as input and returns the length of the longest palindromic subsequence. The input is a single string. Output the length of the longest palindromic subsequence.
Example:
Input:
aabebc
Output:
5
Key concepts
dynamic_programmingstring_manipulation
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