Longest Common substring

My code is failing some test cases can u plz help to spot the mistake will be very thankful

problem https://practice.geeksforgeeks.org/problems/longest-common-substring1452/1#

my code

@joshisanjay8467 in this ques we need a extra variable that stores the max ans and then we return that variable as the ans as dp[i][j] can have some value which will not be the max for all the possible substrings in the back direction i have changed your code a little and also i have passed a global vaiable which will store the ans
Coding Blocks IDE
please see this and let me know if you still face any issue …

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.