Dynamic Programming, Facebook Coding Interview, Google Coding Interview, Coding Interviews, Java.
subsequence Input String s1 and String s2 Dp state dp[i][j] represents LCS of s1.substring(0,i) and s2.substring(0,j) dp[i][0] = dp[j][0] = 0 i = 1 to s1.length j = 1 to s2.length dp[i][j] = dp[i-1][j-1] if s1[i-1] == s2[j-1] max(dp[i-1][j], dp[i][j-1]) otherwise LPS longest palindromic subsequence