Dynamic Programming, Facebook Coding Interview, Google Coding Interview, Coding Interviews, Java.
operations. dp[i][0] = i dp[0][j] = j i = 1 to s1.length j = 1 to s2.length dp[i][j] = dp[i-1][j-1] if s1[i] == s2[j] 1 + min(dp[i-1][j-1], dp[i][j-1], dp[i-1][j]) // min(replace, insert, delete) Regular expression matching Input text String s and pattern String p. Dp state dp[i][j] represents