All test cases not satisfying plz correct this


A small change in line 20 was required. Please check it.

Sir I am not getting why i-1 and j-1
Plz tell

i=0, j=0 indicate empty respective strings.
We start from i=1 till i=s1.length()
And indices in a string are from from 0 till s1.length()-1. That’s why we subtract 1 while checking.

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.