Compute longest palindromic subsequence | J.P. Morgan