Why is it showing wrong output?

hello @supratik260699


for i =0 or j=0
i-1 will be - 1. so in that case it will give run error.

handle that case separately and then it will work

I have made the necessary changes still getting the same answer

image
check this ,
it should be dp[i][j-1];