dp[i][j] = edit distance between the first i chars of A and the first j chars of B. Watch the matrix fill cell by cell, then trace back the match / insert / delete / substitute operations.
dp[n][m]. See junior.md and professional.md for the proof that each cell is the optimal cost of aligning two prefixes.