Mark As Completed Discussion

The Column for Letter "T"

Now that we've successfully filled in the columns for B, E, and S, we can wrap up our matrix with the last column for the letter T from the string best.

Calculating the Costs for "T"

Starting with the first row, T and t are the same characters, so the edit cost is 0. The calculations for this cell are:

  1. From Above: (4 + 1 = 5)
  2. From the Left: (3 + 1 = 4)
  3. From the Diagonal: (3 + 0 = 3)

The minimum of these is 3, so we place it in the cell where T intersects with t.

The Final Matrix

Here's how our fully completed matrix looks:

besT
01234
t11233
e22123
s33212
t44321

Congratulations, you've successfully completed the matrix! The value in the bottom-right corner tells us that the edit distance between best and test is 1, confirming that it would take a minimum of 1 edit to transform one string into the other.