https://ide.codingblocks.com/s/178869 instead of 3 it is showing 0
Why my output is showing wrong
Hi @rssrivastavarohan
You are getting wrong answer because in the starting for loop when you are making first row and column as zero then you are making dp matrix of m+1 rows and n+1 columns but in the further loops you are taking i from 1 to n denoting i as row number but it should be from 1 to m as you have made dp matrix of m+1 rows. This is the reason you are ans as 0. To correct your code all you need to do is that interchange n and m in the nested for loops.
Here is your corrected code :
If your doubt is clear then mark it as resolved.