According to my understanding, we are supposed to fill in the values of first row and col with incremental values of 1 so for a word of length 5 the values in will be 0, 1, 2, 3, 4, 5.

But this test case has values with 2 distance apart I don’t understand why.

1 Like

Hey @Naveen_Malla,

It’s actually not incremental values. Please take a look at section `Part 4.1 Dynamic Programming`

. If you take a look at the `Initialization`

heading in this section, you will find out that values increment by `del_cost`

and `ins_cost`

. Now, although these are defined as 1 in the explanation, but these are not fixed, and hence, the test-cases are checking your implementation for various values of `del_cost`

and `ins_cost`

. I hope this resolves your query.

Cheers,

Elemento

3 Likes

@Naveen_Malla. replace your self-define value to ins_cost, del_cost, rep_cost. I think you will get correct solution

With all the matrix and string indexing to grok, the issue regarding ranges of values for the delete, insert, and swap operations is very subtle given the relative minimal mention of it. Elemento’s note to look closely at Part 4.1 Dynamic Programming is the only brief if explicit focus on the range of values of ideas–his note here is actually clearer than the Part 4.1.