Longest Palindromic Subsequence Problem
Longest Palindromic Subsequence Problem — ExecCode Medium DSA Practice
Solve the Longest Palindromic Subsequence problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Given a string s, return the length of the longest palindromic subsequence in s. A subsequence is derived by deleting some or no characters without changing the order of the remaining characters.
Examples
Input s = "bbbab"; Output 4. Input s = "cbbd"; Output 2. Input s = "a"; Output 1
Constraints
1 ≤ s.length ≤ 1000 s consists of lowercase English letters
Practice Longest Palindromic Subsequence free on ExecCode. Browse DSA problems, topic map, and placement guides.