Approach hintTry it first, then revealHide
Let dp[i][j] say whether the first i characters of s1 and the first j of s2 can form the first i + j characters of s3; extend from the upper or left cell when the next character matches.
Let dp[i][j] say whether the first i characters of s1 and the first j of s2 can form the first i + j characters of s3; extend from the upper or left cell when the next character matches.