It is giving wrong result in my ide

code is working in coding blocks ide but when i run the program in my ide it is giving wrong ans i.e negative number (-1079829936 )

hello @aasif2364

here u should handle cases where tli-1 or tlj-1 is negative.

by default cb ide takes 0 at value for such indices but in some other compiler u may get segmentation fault or garbage valye

i did not understand what to change in this code

check this

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.