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. Work through examples by hand before coding. Understanding the pattern makes implementation simple. Practice with similar problems to reinforce your understanding.