Approach hintTry it first, then revealHide
Let dp[i][j] count the ways the first i characters of s produce the first j characters of t. Character s[i-1] can always be skipped, and it may also be matched when it equals t[j-1]; note that dp[i][0] = 1.