WRITE · TRACE · UNDERSTAND
Edit Distance Rows
Compare prefixes with insertion, deletion and substitution
Your experiment
distance(a, b) returns the fewest single-character insertions, deletions and substitutions turning a into b. Keep only the previous row and the current row.
Python runs in your browser. Your draft stays on this device.
What to look for
Each cell compares two prefixes. Above means delete, left means insert, and the diagonal means match or substitute. Two rows are enough because older rows are never read again.
Watch your code work
Ready to experimentWrite a solution or load the worked answer, then choose Trace & check.
Step through arrays, variables and training curves produced by your own Python.