This is basically a simplified version of global sequence alignment commonly used in bioinformatics. In bioinformatics, different operations are usually assigned different weights to reflect the likelihood. For example, in some situations, mutations are more likely than insertions due to the properties of DNA/RNA, so replacement has lower penalty.
1. Naïve method
This uses a matrix as big as R x C where R is the length of word1 and C is the length of word2.
2. Lower space complexity
3. Some more tweaks
If we set up the initial arrays right, we can skip some of the statements
Comments