This is my code
Please check and let me know where i went wrong
Submatrix sum query code
Hey @mahima issue is in calculating prefix array column wise & prefix array row wise
Also in calculating sum.
Take this code for reference and apply changes in your code
what is the issue in calculating the prefix array and sum?
it would be great if you could reply in detail.
My bad, prefix and suffix is appropriate, i opened wrong code .
Have checked your code. The sum you are calculating, you forgot to check few side cases. Which are mentioned in the code i have given. If any of your doubts regarding this are left, ask here.
what are the side cases you are talking about here, could you please elaborate as none of them were mentioned in the video
Side cases like of any of the 4 parameters are equal to 0. In that case to avoid garbage value, we have added if conditions in code. Rest everything was fine in your code.
yeah got it. Thank you
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.