Company: Publicis Sapient(DS role)_22nov
Difficulty: medium
Longest Palindromic Subsequence Problem Description A palindrome is a sequence that reads the same forwards and backwards, such as "tacocat" or "12221", but not "8675". A subsequence is derived by deleting zero or more characters from the original sequence while maintaining the order of the remaining characters. For instance, the subsequences of "abc" include "a", "b", "c", "ab", "bc", "ac", and "abc". Given a string s composed of n lowercase English letters, identify the length of the longest palindromic subsequence within s. Examples Example 1: Input: n = 2, s = "ba" Output: 1 Explanation: The palindromic subsequences of s = "ab" are "a" and "b". They share a length of 1. Example 2: Input: n = 3, s = "aaa" Output: 3 Explanation: The string s = "aaa" is already palindromic, so return 3 as the answer. Example 3: Input: n = 7, s = "bandana" Output: 5 Explanation: The longest palindromic subsequences of s = "bandana" are "anana" and "andna", each 5 characters long. Constraints - 1 <= n <