Skip to content

Commit 176f9bd

Browse files
committed
minor modifications
1 parent d099945 commit 176f9bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dynamic-programming/question24.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ int findCost(char *str1, char *str2, int cost1, int cost2){
5656

5757
sol[0][0] = 0;
5858

59-
for(i=1;i<len1;i++){
59+
for(i=1;i<len1+1;i++){
6060
sol[i][0] = cost1*i;
6161
}
6262

63-
for(j=1;j<len1;j++){
63+
for(j=1;j<len2+1;j++){
6464
sol[0][j] = cost2*j;
6565
}
6666

@@ -71,6 +71,7 @@ int findCost(char *str1, char *str2, int cost1, int cost2){
7171
}else{
7272
sol[i][j] = findMin(sol[i-1][j]+1,sol[i][j-1] + 2);
7373
}
74+
// printf("adding value for (%d,%d) as %d\n", i,j,sol[i][j]);
7475
}
7576
}
7677

0 commit comments

Comments
 (0)