Approach hintTry it first, then revealHide
Let dp[i][j] be the answer for the first i and j characters. Equal characters extend dp[i-1][j-1]; otherwise take the better of dropping the last character of either string.
Let dp[i][j] be the answer for the first i and j characters. Equal characters extend dp[i-1][j-1]; otherwise take the better of dropping the last character of either string.