Regarding the prefix sum matrix

how to find the prefix sum of a given matrix without using extra space

You would have to use extra space for computing prefix sums if you need less time complexity.
Without extra space also…you can do it…but then you would have to iterate again and again…thus increasing the time complexity.

so in order to make is more efficient we must use extra space, right?

@aslesha.j7 Yes…

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.

I gave you the sample input and output of the prog as you said Im still not clear

I gave you the sample input and output of the prog as you said Im still not clear

you asked me to send the code I sent it in the chat bot. There was an error you asked me to send you sample input and output. I have been trying to send you the image since the last 3 days but everytime it fails. Plz tell me how to send you the image.

You can save the code on ide.codingblocks.com and then share its link.

https://ide.codingblocks.com/s/199428 the link to my code on submatrix sum

plz check my code it is not showing the sum

Hey…sorry for the late response…actually i have marked your doubts as resolved earlier so i am not receiving the notifications. You could have reopened your doubt.
According to your code matrix is of m x n but in you loops, you took j till m…loop for j must be till n…Verify that.
If still doubt is not resolved, then please post it as a new doubt with i/p and expected o/p as this ques is not on hackerblocks.

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.