Why we put the 2D arrays size s1.length()+1 & s2.length()+2

int[][] strg = new int[s1.length() + 1][s2.length() + 2];
why we put the 2D array size in strg[][] as given above

s1.length()+1
&
s2.length()+2
please the solution as soon as possible

@sagarbehal,
we are starting from s1.length(), s2.length() that’s why we add 1 to the size. +2 might have been a mistake because we are not actually using that.

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.