I have to return 0 if top left corner i,j is not exists like -1,0
How to handle the negative index in prefix sum approaches
you simply have to add if condition
if(li>0) and if(lj>0)
Modified Code
checkout this getting wrong ans
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.