Passing 15/16 tests in min_edit_distance

Hi - I’m a bit puzzled with the grading on my min_edit_distance answer. I get the expected output in the example, but the grader shows that I’m failing 1 out of the 16 tests:

Distance matrix has wrong values.
Expected: [[ 0 2 4 6 8 10]
[ 2 0 2 4 6 8]
[ 4 2 0 2 4 6]
[ 6 4 2 0 2 4]
[ 8 6 4 2 3 5]].
Got: [[0 1 2 3 4 5]
[1 0 2 4 6 7]
[2 2 0 2 4 6]
[3 4 2 0 2 4]
[4 6 4 2 3 5]].
15 Tests passed
1 Tests failed

I can’t see what I’ve done wrong with the code. Perhaps if I knew what the test source and target strings looked like, I could trouble shoot.

Thanks,
David

3 Likes

Hi - I ended up figuring out the problem. My issue was I wasn’t initializing row 0 and column 0 correctly (my initialization only worked if del_cost and ins_cost were both set to 1).

7 Likes