Solve Longest Palindromic Subsequence from LeetCode. Given a string, find the longest subsequence that reads the same forwards and backwards.
Hint: This reduces to LCS. Compare the string with its reverse. The LCS of a string and its reverse is the longest palindromic subsequence. For 'bbbab', the answer is : the subsequence 'bbbb' uses indices , , , and reads the same forwards and backwards.