Thanks for the detailed explanation! I would just add one more piece to this : You will not find duplicates if s[i] != s[j] a.k.a
dp[i][j] = dp[i][j - 1] + dp[i + 1][j] - dp[i + 1][j - 1]; //s.charAt(i) != s.charAt(j) this line is perfect.
let us consider the string
x1Sx2, where x1 is s[i] and x2 is s[j]. when x1 != x2, we consider subsequences in x1S and Sx2. We could view each of these subsequences as subsequences with x1 and subsequences without x1 (which are being taken care by - dp[i + 1][j - 1]). Now let us focus our attention on ones which contain x1 at the beginning and ones end with x2.
Let the subsequences be x1s1 and s2x2 respectively. Now, in order for them to be duplicate x1s1 and s2x2 must be palindromes and must be equal.
x1s1 = x1A1x1, s2x2 = x2A2x2 and x1A1x1 = x2A2x2 => x1 = x2.