https://hack.codingblocks.com/contests/c/452/409
https://ide.codingblocks.com/#/s/15491
Wrong answer for edit distance problem
Hello Amritanshu ! actually you missed to add 1 in case when s1[i-1]==s2[j-1] because when they are equal then there can be three cases
- solve for i-1 ,j-1
- solve for i-1 , j and now you have s1 till i-1 same as s2 till j so you have to perform 1 operation for current character , so add 1 —>> 1+dp[i-1][j]
Similarly for - 1+dp[i][j-1]
take minimum of three
See this–>> https://ide.codingblocks.com/#/s/15526